NetBurner 3.5.8
PDF Version
Toggle main menu visibility
vjhc.h
1
/*NB_REVISION*/
2
3
/*NB_COPYRIGHT*/
4
#ifndef NB_VJHC_H
5
#define NB_VJHC_H
6
7
#include <ip.h>
8
const
int
VJHC_MAX_HDR = 128;
/* max TCP+IP hdr length (by protocol def) */
9
const
uint8_t VJHC_MAX_STATES = 16;
/* must be >2 and <255 */
10
/*
11
* "state" data for each active tcp conversation on the wire. This is
12
* basically a copy of the entire IP/TCP header from the last packet together
13
* with a small identifier the transmit & receive ends of the line use to
14
* locate saved header.
15
*/
16
17
typedef
struct
18
{
19
beuint16_t th_sport;
20
beuint16_t th_dport;
21
beuint32_t th_seq;
22
beuint32_t th_ack;
23
uint8_t th_len;
24
uint8_t th_flags;
25
beuint16_t th_win;
26
beuint16_t th_sum;
27
beuint16_t th_urp;
28
} __attribute__((packed)) vjtcphdr;
29
30
inline
vjtcphdr *GetVJTcpHdrFromIp(
IPPKT
*pIp)
31
{
32
uint32_t hlen = (pIp->
bVerHdrLen
& 0x0F);
33
return
(vjtcphdr *)(((puint32_t)(pIp)) + hlen);
34
}
35
36
struct
__attribute__((packed)) cstate
37
{
38
beuint16_t cs_hlen;
/* size of hdr (receive only) */
39
uint8_t cs_id;
/* connection # associated with this state */
40
uint8_t cs_filler;
41
42
union
__attribute__((packed))
43
{
44
IPPKT csu_ip;
/* ip/tcp hdr from most recent packet */
45
char
extra[VJHC_MAX_HDR];
46
};
47
48
void
Clear();
49
bool
Match(IPPKT *pIp);
50
vjtcphdr *GetHdr();
51
};
52
53
#define cs_hdr (char *)&csu_ip
54
#define cs_ip csu_ip
55
56
class
slcompress
57
{
58
private
:
59
int
last_tsn;
/* most recently used tstate */
60
uint8_t last_recv;
/* last rcvd conn. id */
61
uint8_t last_xmit;
/* last sent conn. id */
62
beuint16_t flags;
63
struct
cstate tstate[VJHC_MAX_STATES];
/* xmit connection states */
64
struct
cstate rstate[VJHC_MAX_STATES];
/* receive connection states */
65
public
:
66
volatile
int
NumStatesRX;
67
volatile
int
NumStatesTX;
68
69
uint8_t compress_tcp(uint8_t *&pData,
int
&data_len,
int
compress_cid);
70
PoolPtr uncompress_tcp(PoolPtr p, uint8_t *bufp,
int
len, uint32_t type);
71
void
init
();
72
};
73
74
#endif
init
void init()
System initialization. Ideally called at the beginning of all applications, since the easiest Recover...
IPPKT
Internal IPv4 Header Representation.
Definition
ip.h:169
IPPKT::bVerHdrLen
uint8_t bVerHdrLen
Version and header length (same as versionNLength in IpHeaderIPv4).
Definition
ip.h:170
nbrtos
include
vjhc.h
Generated by
1.18.0