NetBurner 3.1
vjhc.h
1 /*NB_REVISION*/
2 
3 /*NB_COPYRIGHT*/
4 
5 #define MAX_HDR 128 /* max TCP+IP hdr length (by protocol def) */
6 #define MAX_STATES 16 /* must be >2 and <255 */
7 /*
8  * "state" data for each active tcp conversation on the wire. This is
9  * basically a copy of the entire IP/TCP header from the last packet together
10  * with a small identifier the transmit & receive ends of the line use to
11  * locate saved header.
12  */
13 
14 extern volatile int NumStatesRX;
15 extern volatile int NumStatesTX;
16 
17 struct cstate
18 {
19  struct cstate *cs_next; /* next most recently used cstate (xmit only) */
20  beuint16_t cs_hlen; /* size of hdr (receive only) */
21  uint8_t cs_id; /* connection # associated with this state */
22  uint8_t cs_filler;
23  union {
24  IPPKT csu_ip; /* ip/tcp hdr from most recent packet */
25  char extra[MAX_HDR];
26  };
27 };
28 
29 #define cs_hdr (char *)&csu_ip
30 #define cs_ip csu_ip
31 
32 struct slcompress
33 {
34  struct cstate *last_cs; /* most recently used tstate */
35  uint8_t last_recv; /* last rcvd conn. id */
36  uint8_t last_xmit; /* last sent conn. id */
37  beuint16_t flags;
38  struct cstate tstate[MAX_STATES]; /* xmit connection states */
39  struct cstate rstate[MAX_STATES]; /* receive connection states */
40 };
41 
42 struct mbuf
43 {
44  uint8_t *m_off; /* pointer to start of data */
45  int m_len; /* length of data */
46 };
47 
48 uint8_t sl_compress_tcp(mbuf *m, slcompress *comp, int compress_cid);
49 PoolPtr sl_uncompress_tcp(PoolPtr p, uint8_t *bufp, int len, uint32_t type, slcompress *comp);
50 void sl_compress_init(slcompress *comp);