HEAD: rearrange things a bit so we can have a libwvbase.so, which contains
[wvapps.git] / wvipsec / wvespstream.h
blobd8caf484542e0149fd4a8e718aebc882b7f47583
1 /*
2 * Worldvisions Weaver Software:
3 * Copyright (C) 2003 Net Integration Technologies, Inc.
5 * ESP implementation for WvIPSec
6 */
8 #ifndef __WVESPSTREAM_H
9 #define __WVESPSTREAM_H
11 #include <bitset>
13 #include "wvaddr.h"
14 #include "wvipraw.h"
15 #include "wvcrypto.h"
16 #include "wvdigest.h"
17 #include "wvbuf.h"
19 #include "wvlog.h"
21 #define WindowSize 64
23 /**
24 * A WvStream for an IPsec ESP connection.
26 class WvESPStream : public WvIPRawStream
28 public:
29 WvESPStream(const WvIPAddr &_local, const WvIPAddr &_remote,
30 WvDigest *_auth, WvEncoder *_enc, WvEncoder *_dec,
31 int _spi);
33 ~WvESPStream();
35 virtual void execute();
36 virtual size_t uwrite(const void *inbuf, size_t count);
37 virtual size_t uread(void *outbuf, size_t count);
38 virtual bool isok() const;
40 protected:
41 bool invalid_counter(unsigned int sn);
42 std::bitset<WindowSize> window;
43 unsigned int recv_seqno;
45 private:
46 WvDigest *auth;
47 WvEncoder *enc, *dec;
48 WvLog log;
50 // Security Parameters Index
51 int spi;
53 // Sequence Number for this ESP session
54 unsigned int seq_number;
56 // ???
57 unsigned int counter;
58 bool check_count;
61 #endif // __WVESPSTREAM_H