25 |
#ifndef _VJCOMPRESS_H_ |
#ifndef _VJCOMPRESS_H_ |
26 |
#define _VJCOMPRESS_H_ |
#define _VJCOMPRESS_H_ |
27 |
|
|
28 |
#define MAX_STATES 16 /* must be > 2 and < 256 */ |
#define MAX_STATES 16 /* must be > 2 and < 256 */ |
29 |
#define MAX_HDR 128 |
#define MAX_HDR 128 |
30 |
|
|
31 |
/* |
/* |
78 |
#define TYPE_ERROR 0x00 |
#define TYPE_ERROR 0x00 |
79 |
|
|
80 |
/* Bits in first octet of compressed packet */ |
/* Bits in first octet of compressed packet */ |
81 |
#define NEW_C 0x40 /* flag bits for what changed in a packet */ |
#define NEW_C 0x40 /* flag bits for what changed in a packet */ |
82 |
#define NEW_I 0x20 |
#define NEW_I 0x20 |
83 |
#define NEW_S 0x08 |
#define NEW_S 0x08 |
84 |
#define NEW_A 0x04 |
#define NEW_A 0x04 |
86 |
#define NEW_U 0x01 |
#define NEW_U 0x01 |
87 |
|
|
88 |
/* reserved, special-case values of above */ |
/* reserved, special-case values of above */ |
89 |
#define SPECIAL_I (NEW_S|NEW_W|NEW_U) /* echoed interactive traffic */ |
#define SPECIAL_I (NEW_S|NEW_W|NEW_U) /* echoed interactive traffic */ |
90 |
#define SPECIAL_D (NEW_S|NEW_A|NEW_W|NEW_U) /* unidirectional data */ |
#define SPECIAL_D (NEW_S|NEW_A|NEW_W|NEW_U) /* unidirectional data */ |
91 |
#define SPECIALS_MASK (NEW_S|NEW_A|NEW_W|NEW_U) |
#define SPECIALS_MASK (NEW_S|NEW_A|NEW_W|NEW_U) |
92 |
|
|
93 |
#define TCP_PUSH_BIT 0x10 |
#define TCP_PUSH_BIT 0x10 |
99 |
* we saw from the conversation together with a small identifier |
* we saw from the conversation together with a small identifier |
100 |
* the transmit & receive ends of the line use to locate saved header. |
* the transmit & receive ends of the line use to locate saved header. |
101 |
*/ |
*/ |
102 |
struct cstate { |
struct cstate |
103 |
struct cstate *cs_next; /* next most recently used state (xmit only) */ |
{ |
104 |
u_short cs_hlen; /* size of hdr (receive only) */ |
struct cstate *cs_next; /* next most recently used state (xmit only) */ |
105 |
u_char cs_id; /* connection # associated with this state */ |
u_short cs_hlen; /* size of hdr (receive only) */ |
106 |
u_char cs_filler; |
u_char cs_id; /* connection # associated with this state */ |
107 |
union { |
u_char cs_filler; |
108 |
char csu_hdr[MAX_HDR]; |
union |
109 |
struct ip csu_ip; /* ip/tcp hdr from most recent packet */ |
{ |
110 |
} vjcs_u; |
char csu_hdr[MAX_HDR]; |
111 |
|
struct ip csu_ip; /* ip/tcp hdr from most recent packet */ |
112 |
|
} |
113 |
|
vjcs_u; |
114 |
}; |
}; |
115 |
#define cs_ip vjcs_u.csu_ip |
#define cs_ip vjcs_u.csu_ip |
116 |
#define cs_hdr vjcs_u.csu_hdr |
#define cs_hdr vjcs_u.csu_hdr |
118 |
/* |
/* |
119 |
* all the state data for one serial line (we need one of these per line). |
* all the state data for one serial line (we need one of these per line). |
120 |
*/ |
*/ |
121 |
struct vjcompress { |
struct vjcompress |
122 |
struct cstate *last_cs; /* most recently used tstate */ |
{ |
123 |
u_char last_recv; /* last rcvd conn. id */ |
struct cstate *last_cs; /* most recently used tstate */ |
124 |
u_char last_xmit; /* last sent conn. id */ |
u_char last_recv; /* last rcvd conn. id */ |
125 |
u_short flags; |
u_char last_xmit; /* last sent conn. id */ |
126 |
|
u_short flags; |
127 |
#ifndef VJ_NO_STATS |
#ifndef VJ_NO_STATS |
128 |
struct vjstat stats; |
struct vjstat stats; |
129 |
#endif |
#endif |
130 |
struct cstate tstate[MAX_STATES]; /* xmit connection states */ |
struct cstate tstate[MAX_STATES]; /* xmit connection states */ |
131 |
struct cstate rstate[MAX_STATES]; /* receive connection states */ |
struct cstate rstate[MAX_STATES]; /* receive connection states */ |
132 |
}; |
}; |
133 |
|
|
134 |
/* flag values */ |
/* flag values */ |
135 |
#define VJF_TOSS 1 /* tossing rcvd frames because of input err */ |
#define VJF_TOSS 1 /* tossing rcvd frames because of input err */ |
136 |
|
|
137 |
extern void vj_compress_init __P((struct vjcompress *comp, int max_state)); |
extern void vj_compress_init __P ((struct vjcompress * comp, int max_state)); |
138 |
extern u_int vj_compress_tcp __P((struct ip *ip, u_int mlen, |
extern u_int vj_compress_tcp __P ((struct ip * ip, u_int mlen, |
139 |
struct vjcompress *comp, int compress_cid_flag, |
struct vjcompress * comp, |
140 |
u_char **vjhdrp)); |
int compress_cid_flag, u_char ** vjhdrp)); |
141 |
extern void vj_uncompress_err __P((struct vjcompress *comp)); |
extern void vj_uncompress_err __P ((struct vjcompress * comp)); |
142 |
extern int vj_uncompress_uncomp __P((u_char *buf, int buflen, |
extern int vj_uncompress_uncomp __P ((u_char * buf, int buflen, |
143 |
struct vjcompress *comp)); |
struct vjcompress * comp)); |
144 |
extern int vj_uncompress_tcp __P((u_char *buf, int buflen, int total_len, |
extern int vj_uncompress_tcp __P ((u_char * buf, int buflen, int total_len, |
145 |
struct vjcompress *comp, u_char **hdrp, |
struct vjcompress * comp, u_char ** hdrp, |
146 |
u_int *hlenp)); |
u_int * hlenp)); |
147 |
|
|
148 |
#endif /* _VJCOMPRESS_H_ */ |
#endif /* _VJCOMPRESS_H_ */ |