diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1998-05-08 05:02:10 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1998-05-08 05:02:10 +0000 |
commit | c1da574ca1009fd0765d0814b63388a4267ccc0a (patch) | |
tree | 955d0ec675fcf50bdd1534b6e185d4cc871d9cee /sys | |
parent | de1c15bacfef205336e6ed358d45722777574cc8 (diff) |
Add support for RFC-comliant deflate protocol
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/if_ppp.c | 5 | ||||
-rw-r--r-- | sys/net/if_pppvar.h | 7 | ||||
-rw-r--r-- | sys/net/ppp-comp.h | 22 | ||||
-rw-r--r-- | sys/net/ppp-deflate.c | 30 | ||||
-rw-r--r-- | sys/net/ppp_defs.h | 6 | ||||
-rw-r--r-- | sys/net/slcompress.h | 8 |
6 files changed, 56 insertions, 22 deletions
diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c index 0e31d45bd13..1ed121e0302 100644 --- a/sys/net/if_ppp.c +++ b/sys/net/if_ppp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ppp.c,v 1.11 1997/09/05 04:26:58 millert Exp $ */ +/* $OpenBSD: if_ppp.c,v 1.12 1998/05/08 05:02:09 millert Exp $ */ /* $NetBSD: if_ppp.c,v 1.39 1997/05/17 21:11:59 christos Exp $ */ /* @@ -159,7 +159,7 @@ void pppdumpm __P((struct mbuf *m0)); */ extern struct compressor ppp_bsd_compress; -extern struct compressor ppp_deflate; +extern struct compressor ppp_deflate, ppp_deflate_draft; struct compressor *ppp_compressors[8] = { #if DO_BSD_COMPRESS && defined(PPP_BSDCOMP) @@ -167,6 +167,7 @@ struct compressor *ppp_compressors[8] = { #endif #if DO_DEFLATE && defined(PPP_DEFLATE) &ppp_deflate, + &ppp_deflate_draft, #endif NULL }; diff --git a/sys/net/if_pppvar.h b/sys/net/if_pppvar.h index 98f524fe68f..69fb536960c 100644 --- a/sys/net/if_pppvar.h +++ b/sys/net/if_pppvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pppvar.h,v 1.6 1997/09/05 04:27:00 millert Exp $ */ +/* $OpenBSD: if_pppvar.h,v 1.7 1998/05/08 05:02:08 millert Exp $ */ /* $NetBSD: if_pppvar.h,v 1.5 1997/01/03 07:23:29 mikel Exp $ */ /* * if_pppvar.h - private structures and declarations for PPP. @@ -42,6 +42,9 @@ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ +#ifndef _NET_IF_PPPVAR_H_ +#define _NET_IF_PPPVAR_H_ + /* * Supported network protocols. These values are used for * indexing sc_npmode. @@ -110,3 +113,5 @@ void ppp_restart __P((struct ppp_softc *sc)); int pppoutput __P((struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *)); #endif /* _KERNEL */ + +#endif /* _NET_IF_PPPVAR_H_ */ diff --git a/sys/net/ppp-comp.h b/sys/net/ppp-comp.h index 6e34830e7ca..e0064097c18 100644 --- a/sys/net/ppp-comp.h +++ b/sys/net/ppp-comp.h @@ -1,5 +1,4 @@ -/* $OpenBSD: ppp-comp.h,v 1.3 1997/02/24 13:34:03 niklas Exp $ */ -/* $NetBSD: ppp-comp.h,v 1.2 1996/03/15 02:28:07 paulus Exp $ */ +/* $OpenBSD: ppp-comp.h,v 1.4 1998/05/08 05:02:01 millert Exp $ */ /* * ppp-comp.h - Definitions for doing PPP packet compression. @@ -27,6 +26,7 @@ * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, * OR MODIFICATIONS. * + * Id: ppp-comp.h,v 1.11 1998/03/25 03:33:34 paulus Exp $ */ #ifndef _NET_PPP_COMP_H @@ -141,14 +141,10 @@ struct compressor { #define BSD_MAX_BITS 15 /* largest code size supported */ /* - * Definitions for other, as yet unsupported, compression methods. + * Definitions for Deflate. */ -#define CI_PREDICTOR_1 1 /* config option for Predictor-1 */ -#define CILEN_PREDICTOR_1 2 /* length of its config option */ -#define CI_PREDICTOR_2 2 /* config option for Predictor-2 */ -#define CILEN_PREDICTOR_2 2 /* length of its config option */ - -#define CI_DEFLATE 24 /* config option for Deflate */ +#define CI_DEFLATE 26 /* config option for Deflate */ +#define CI_DEFLATE_DRAFT 24 /* value used in original draft RFC */ #define CILEN_DEFLATE 4 /* length of its config option */ #define DEFLATE_MIN_SIZE 8 @@ -160,4 +156,12 @@ struct compressor { + DEFLATE_METHOD_VAL) #define DEFLATE_CHK_SEQUENCE 0 +/* + * Definitions for other, as yet unsupported, compression methods. + */ +#define CI_PREDICTOR_1 1 /* config option for Predictor-1 */ +#define CILEN_PREDICTOR_1 2 /* length of its config option */ +#define CI_PREDICTOR_2 2 /* config option for Predictor-2 */ +#define CILEN_PREDICTOR_2 2 /* length of its config option */ + #endif /* _NET_PPP_COMP_H */ diff --git a/sys/net/ppp-deflate.c b/sys/net/ppp-deflate.c index 3a01d20836f..bb391cadfcf 100644 --- a/sys/net/ppp-deflate.c +++ b/sys/net/ppp-deflate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ppp-deflate.c,v 1.4 1997/09/05 04:27:03 millert Exp $ */ +/* $OpenBSD: ppp-deflate.c,v 1.5 1998/05/08 05:02:07 millert Exp $ */ /* $NetBSD: ppp-deflate.c,v 1.1 1996/03/15 02:28:09 paulus Exp $ */ /* @@ -97,6 +97,22 @@ struct compressor ppp_deflate = { z_comp_stats, /* decomp_stat */ }; +struct compressor ppp_deflate_draft = { + CI_DEFLATE_DRAFT, /* compress_proto */ + z_comp_alloc, /* comp_alloc */ + z_comp_free, /* comp_free */ + z_comp_init, /* comp_init */ + z_comp_reset, /* comp_reset */ + z_compress, /* compress */ + z_comp_stats, /* comp_stat */ + z_decomp_alloc, /* decomp_alloc */ + z_decomp_free, /* decomp_free */ + z_decomp_init, /* decomp_init */ + z_decomp_reset, /* decomp_reset */ + z_decompress, /* decompress */ + z_incomp, /* incomp */ + z_comp_stats, /* decomp_stat */ +}; /* * Space allocation and freeing routines for use by zlib routines. */ @@ -131,7 +147,8 @@ z_comp_alloc(options, opt_len) struct deflate_state *state; int w_size; - if (opt_len != CILEN_DEFLATE || options[0] != CI_DEFLATE + if (opt_len != CILEN_DEFLATE + || (options[0] != CI_DEFLATE && options[0] != CI_DEFLATE_DRAFT) || options[1] != CILEN_DEFLATE || DEFLATE_METHOD(options[2]) != DEFLATE_METHOD_VAL || options[3] != DEFLATE_CHK_SEQUENCE) @@ -177,7 +194,8 @@ z_comp_init(arg, options, opt_len, unit, hdrlen, debug) { struct deflate_state *state = (struct deflate_state *) arg; - if (opt_len < CILEN_DEFLATE || options[0] != CI_DEFLATE + if (opt_len < CILEN_DEFLATE + || (options[0] != CI_DEFLATE && options[0] != CI_DEFLATE_DRAFT) || options[1] != CILEN_DEFLATE || DEFLATE_METHOD(options[2]) != DEFLATE_METHOD_VAL || DEFLATE_SIZE(options[2]) != state->w_size @@ -362,7 +380,8 @@ z_decomp_alloc(options, opt_len) struct deflate_state *state; int w_size; - if (opt_len != CILEN_DEFLATE || options[0] != CI_DEFLATE + if (opt_len != CILEN_DEFLATE + || (options[0] != CI_DEFLATE && options[0] != CI_DEFLATE_DRAFT) || options[1] != CILEN_DEFLATE || DEFLATE_METHOD(options[2]) != DEFLATE_METHOD_VAL || options[3] != DEFLATE_CHK_SEQUENCE) @@ -407,7 +426,8 @@ z_decomp_init(arg, options, opt_len, unit, hdrlen, mru, debug) { struct deflate_state *state = (struct deflate_state *) arg; - if (opt_len < CILEN_DEFLATE || options[0] != CI_DEFLATE + if (opt_len < CILEN_DEFLATE + || (options[0] != CI_DEFLATE && options[0] != CI_DEFLATE_DRAFT) || options[1] != CILEN_DEFLATE || DEFLATE_METHOD(options[2]) != DEFLATE_METHOD_VAL || DEFLATE_SIZE(options[2]) != state->w_size diff --git a/sys/net/ppp_defs.h b/sys/net/ppp_defs.h index 2129a0aa052..7c1edef093b 100644 --- a/sys/net/ppp_defs.h +++ b/sys/net/ppp_defs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ppp_defs.h,v 1.4 1997/02/24 13:34:04 niklas Exp $ */ +/* $OpenBSD: ppp_defs.h,v 1.5 1998/05/08 05:01:59 millert Exp $ */ /* $NetBSD: ppp_defs.h,v 1.1 1995/07/04 06:28:26 paulus Exp $ */ /* @@ -55,11 +55,14 @@ * Protocol field values. */ #define PPP_IP 0x21 /* Internet Protocol */ +#define PPP_AT 0x29 /* AppleTalk Protocol */ #define PPP_IPX 0x2b /* Internetwork Packet Exchange */ #define PPP_VJC_COMP 0x2d /* VJ compressed TCP */ #define PPP_VJC_UNCOMP 0x2f /* VJ uncompressed TCP */ +#define PPP_IPV6 0x57 /* Internet Protocol Version 6 */ #define PPP_COMP 0xfd /* compressed packet */ #define PPP_IPCP 0x8021 /* IP Control Protocol */ +#define PPP_ATCP 0x8029 /* AppleTalk Control Protocol */ #define PPP_IPXCP 0x802b /* IPX Control Protocol */ #define PPP_CCP 0x80fd /* Compression Control Protocol */ #define PPP_LCP 0xc021 /* Link Control Protocol */ @@ -83,6 +86,7 @@ typedef UINT32_T u_int32_t; #else typedef unsigned int u_int32_t; +typedef unsigned short u_int16_t; #endif #endif diff --git a/sys/net/slcompress.h b/sys/net/slcompress.h index c52b485126e..40a07d7905f 100644 --- a/sys/net/slcompress.h +++ b/sys/net/slcompress.h @@ -1,4 +1,4 @@ -/* $OpenBSD: slcompress.h,v 1.3 1997/09/05 04:27:05 millert Exp $ */ +/* $OpenBSD: slcompress.h,v 1.4 1998/05/08 05:02:02 millert Exp $ */ /* $NetBSD: slcompress.h,v 1.11 1997/05/17 21:12:11 christos Exp $ */ /* @@ -43,8 +43,8 @@ * - Initial distribution. */ -#ifndef _SLCOMPRESS_H_ -#define _SLCOMPRESS_H_ +#ifndef _NET_SLCOMPRESS_H_ +#define _NET_SLCOMPRESS_H_ #define MAX_STATES 16 /* must be > 2 and < 256 */ #define MAX_HDR MLEN /* XXX 4bsd-ism: should really be 128 */ @@ -166,4 +166,4 @@ int sl_uncompress_tcp __P((u_char **, int, u_int, struct slcompress *)); int sl_uncompress_tcp_core __P((u_char *, int, int, u_int, struct slcompress *, u_char **, u_int *)); -#endif /* _SLCOMPRESS_H_ */ +#endif /* _NET_SLCOMPRESS_H_ */ |