Please wait until the page is fully downloaded and then press the "Expand" button or the blue line numbers.
0104000 /*
0104001 net/gen/vjhc.h
0104002
0104003 Defines for Van Jacobson TCP/IP Header Compression as defined in RFC-1144
0104004
0104005 Created: Nov 15, 1993 by Philip Homburg <philip@cs.vu.nl>
0104006 */
0104007
0104008 #ifndef __NET__GEN__VJHC_H__
0104009 #define __NET__GEN__VJHC_H__
0104010
0104011 #define VJHC_FLAG_U 0x01
0104012 #define VJHC_FLAG_W 0x02
0104013 #define VJHC_FLAG_A 0x04
0104014 #define VJHC_FLAG_S 0x08
0104015 #define VJHC_FLAG_P 0x10
0104016 #define VJHC_FLAG_I 0x20
0104017 #define VJHC_FLAG_C 0x40
0104018
0104019 #define VJHC_SPEC_I (VJHC_FLAG_S | VJHC_FLAG_W | VJHC_FLAG_U)
0104020 #define VJHC_SPEC_D (VJHC_FLAG_S | VJHC_FLAG_A | VJHC_FLAG_W | VJHC_FLAG_U)
0104021 #define VJHC_SPEC_MASK (VJHC_FLAG_S | VJHC_FLAG_A | VJHC_FLAG_W | VJHC_FLAG_U)
0104022
0104023 #define VJHC_ENCODE(cp, n) \
0104024 { \
0104025 if ((u16_t)(n) >= 256) \
0104026 { \
0104027 *(cp)++= 0; \
0104028 *(cp)++= (n >> 8); \
0104029 *(cp)++= (n); \
0104030 } \
0104031 else \
0104032 *(cp)++= (n); \
0104033 }
0104034
0104035 #define VJHC_ENCODEZ(cp, n) \
0104036 { \
0104037 if ((u16_t)(n) == 0 || (u16_t)(n) >= 256) \
0104038 { \
0104039 *(cp)++= 0; \
0104040 *(cp)++= (n >> 8); \
0104041 *(cp)++= (n); \
0104042 } \
0104043 else \
0104044 *(cp)++= (n); \
0104045 }
0104046
0104047 #define VJHC_DECODEL(cp, l) \
0104048 { \
0104049 if (*(cp) == 0) \
0104050 { \
0104051 (l)= htonl(ntohl((l)) + (((cp)[1] << 8) | (cp)[2])); \
0104052 (cp) += 3; \
0104053 } \
0104054 else \
0104055 (l)= htonl(ntohl((l)) + (u32_t)*(cp)++); \
0104056 }
0104057
0104058 #define VJHC_DECODES(cp, s) \
0104059 { \
0104060 if (*(cp) == 0) \
0104061 { \
0104062 (s)= htons(ntohs((s)) + (((cp)[1] << 8) | (cp)[2])); \
0104063 (cp) += 3; \
0104064 } \
0104065 else \
0104066 (s)= htons(ntohs((s)) + (u16_t)*(cp)++); \
0104067 }
0104068
0104069 #define VJHC_DECODEU(cp, s) \
0104070 { \
0104071 if (*(cp) == 0) \
0104072 { \
0104073 (s)= htons(((cp)[1] << 8) | (cp)[2]); \
0104074 (cp) += 3; \
0104075 } \
0104076 else \
0104077 (s)= htons((u16_t)*(cp)++); \
0104078 }
0104079
0104080 #endif /* __NET__GEN__VJHC_H__ */
0104081
0104082 /*
0104083 * $PchId: vjhc.h,v 1.2 1995/11/17 22:14:46 philip Exp $
0104084 */