slcompress.h (26516) | slcompress.h (28679) |
---|---|
1/* 2 * Definitions for tcp compression routines. 3 * | 1/* 2 * Definitions for tcp compression routines. 3 * |
4 * $Header: /home/ncvs/src/usr.sbin/ppp/slcompress.h,v 1.5 1997/02/22 16:10:55 peter Exp $ | 4 * $Header: /home/ncvs/src/usr.sbin/ppp/slcompress.h,v 1.6 1997/06/09 03:27:38 brian Exp $ |
5 * 6 * Copyright (c) 1989 Regents of the University of California. 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms are permitted 10 * provided that the above copyright notice and this paragraph are 11 * duplicated in all such forms and that any documentation, 12 * advertising materials, and other materials related to such 13 * distribution and use acknowledge that the software was developed 14 * by the University of California, Berkeley. The name of the 15 * University may not be used to endorse or promote products derived 16 * from this software without specific prior written permission. 17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 19 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 20 * | 5 * 6 * Copyright (c) 1989 Regents of the University of California. 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms are permitted 10 * provided that the above copyright notice and this paragraph are 11 * duplicated in all such forms and that any documentation, 12 * advertising materials, and other materials related to such 13 * distribution and use acknowledge that the software was developed 14 * by the University of California, Berkeley. The name of the 15 * University may not be used to endorse or promote products derived 16 * from this software without specific prior written permission. 17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 19 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 20 * |
21 * $Id: slcompress.h,v 1.5 1997/02/22 16:10:55 peter Exp $ | 21 * $Id: slcompress.h,v 1.6 1997/06/09 03:27:38 brian Exp $ |
22 * 23 * Van Jacobson (van@helios.ee.lbl.gov), Dec 31, 1989: 24 * - Initial distribution. 25 */ 26 27#define MAX_STATES 16 /* must be > 2 and < 256 */ 28#define MAX_HDR 128 /* XXX 4bsd-ism: should really be 128 */ 29 --- 42 unchanged lines hidden (view full) --- 72 73/* packet types */ 74#define TYPE_IP 0x40 75#define TYPE_UNCOMPRESSED_TCP 0x70 76#define TYPE_COMPRESSED_TCP 0x80 77#define TYPE_ERROR 0x00 78 79/* Bits in first octet of compressed packet */ | 22 * 23 * Van Jacobson (van@helios.ee.lbl.gov), Dec 31, 1989: 24 * - Initial distribution. 25 */ 26 27#define MAX_STATES 16 /* must be > 2 and < 256 */ 28#define MAX_HDR 128 /* XXX 4bsd-ism: should really be 128 */ 29 --- 42 unchanged lines hidden (view full) --- 72 73/* packet types */ 74#define TYPE_IP 0x40 75#define TYPE_UNCOMPRESSED_TCP 0x70 76#define TYPE_COMPRESSED_TCP 0x80 77#define TYPE_ERROR 0x00 78 79/* Bits in first octet of compressed packet */ |
80#define NEW_C 0x40 /* flag bits for what changed in a packet */ | 80#define NEW_C 0x40 /* flag bits for what changed in a packet */ |
81#define NEW_I 0x20 82#define NEW_S 0x08 83#define NEW_A 0x04 84#define NEW_W 0x02 85#define NEW_U 0x01 86 87/* reserved, special-case values of above */ | 81#define NEW_I 0x20 82#define NEW_S 0x08 83#define NEW_A 0x04 84#define NEW_W 0x02 85#define NEW_U 0x01 86 87/* reserved, special-case values of above */ |
88#define SPECIAL_I (NEW_S|NEW_W|NEW_U) /* echoed interactive traffic */ | 88#define SPECIAL_I (NEW_S|NEW_W|NEW_U) /* echoed interactive traffic */ |
89#define SPECIAL_D (NEW_S|NEW_A|NEW_W|NEW_U) /* unidirectional data */ 90#define SPECIALS_MASK (NEW_S|NEW_A|NEW_W|NEW_U) 91 92#define TCP_PUSH_BIT 0x10 93 94/* 95 * "state" data for each active tcp conversation on the wire. This is 96 * basically a copy of the entire IP/TCP header from the last packet 97 * we saw from the conversation together with a small identifier 98 * the transmit & receive ends of the line use to locate saved header. 99 */ 100struct cstate { | 89#define SPECIAL_D (NEW_S|NEW_A|NEW_W|NEW_U) /* unidirectional data */ 90#define SPECIALS_MASK (NEW_S|NEW_A|NEW_W|NEW_U) 91 92#define TCP_PUSH_BIT 0x10 93 94/* 95 * "state" data for each active tcp conversation on the wire. This is 96 * basically a copy of the entire IP/TCP header from the last packet 97 * we saw from the conversation together with a small identifier 98 * the transmit & receive ends of the line use to locate saved header. 99 */ 100struct cstate { |
101 struct cstate *cs_next; /* next most recently used cstate (xmit only) */ 102 u_short cs_hlen; /* size of hdr (receive only) */ 103 u_char cs_id; /* connection # associated with this state */ 104 u_char cs_filler; 105 union { 106 char csu_hdr[MAX_HDR]; 107 struct ip csu_ip; /* ip/tcp hdr from most recent packet */ 108 } slcs_u; | 101 struct cstate *cs_next; /* next most recently used cstate (xmit only) */ 102 u_short cs_hlen; /* size of hdr (receive only) */ 103 u_char cs_id; /* connection # associated with this state */ 104 u_char cs_filler; 105 union { 106 char csu_hdr[MAX_HDR]; 107 struct ip csu_ip; /* ip/tcp hdr from most recent packet */ 108 } slcs_u; |
109}; | 109}; |
110 |
|
110#define cs_ip slcs_u.csu_ip 111#define cs_hdr slcs_u.csu_hdr 112 113/* 114 * all the state data for one serial line (we need one of these 115 * per line). 116 */ 117struct slcompress { | 111#define cs_ip slcs_u.csu_ip 112#define cs_hdr slcs_u.csu_hdr 113 114/* 115 * all the state data for one serial line (we need one of these 116 * per line). 117 */ 118struct slcompress { |
118 struct cstate *last_cs; /* most recently used tstate */ 119 u_char last_recv; /* last rcvd conn. id */ 120 u_char last_xmit; /* last sent conn. id */ 121 u_short flags; 122 struct cstate tstate[MAX_STATES]; /* xmit connection states */ 123 struct cstate rstate[MAX_STATES]; /* receive connection states */ | 119 struct cstate *last_cs; /* most recently used tstate */ 120 u_char last_recv; /* last rcvd conn. id */ 121 u_char last_xmit; /* last sent conn. id */ 122 u_short flags; 123 struct cstate tstate[MAX_STATES]; /* xmit connection states */ 124 struct cstate rstate[MAX_STATES]; /* receive connection states */ |
124}; 125 126struct slstat { 127 int sls_packets; /* outbound packets */ 128 int sls_compressed; /* outbound compressed packets */ 129 int sls_searches; /* searches for connection state */ 130 int sls_misses; /* times couldn't find conn. state */ | 125}; 126 127struct slstat { 128 int sls_packets; /* outbound packets */ 129 int sls_compressed; /* outbound compressed packets */ 130 int sls_searches; /* searches for connection state */ 131 int sls_misses; /* times couldn't find conn. state */ |
131 int sls_uncompressedin; /* inbound uncompressed packets */ 132 int sls_compressedin; /* inbound compressed packets */ | 132 int sls_uncompressedin; /* inbound uncompressed packets */ 133 int sls_compressedin; /* inbound compressed packets */ |
133 int sls_errorin; /* inbound unknown type packets */ 134 int sls_tossed; /* inbound packets tossed because of error */ 135}; 136 137/* flag values */ 138#define SLF_TOSS 1 /* tossing rcvd frames because of input err */ 139 140extern void sl_compress_init(struct slcompress *); | 134 int sls_errorin; /* inbound unknown type packets */ 135 int sls_tossed; /* inbound packets tossed because of error */ 136}; 137 138/* flag values */ 139#define SLF_TOSS 1 /* tossing rcvd frames because of input err */ 140 141extern void sl_compress_init(struct slcompress *); |
141extern u_char sl_compress_tcp __P((struct mbuf *, struct ip *, 142 struct slcompress *, int compress_cid_flag)); 143extern int sl_uncompress_tcp(u_char **, int, u_int, struct slcompress *); | 142extern u_char sl_compress_tcp 143__P((struct mbuf *, struct ip *, 144 struct slcompress *, int compress_cid_flag)); 145 extern int sl_uncompress_tcp(u_char **, int, u_int, struct slcompress *); |