From: Paul Mackerras Date: Mon, 14 Jul 1997 03:51:54 +0000 (+0000) Subject: mods from Christos Zoulas to fit with netbsd-current slcompress stuff X-Git-Tag: RELEASE_2_3_6~172 X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=commitdiff_plain;h=175500f00494c77acb3e6ba8404adbfd34ee03ba;hp=16b34a2fc4f177d3eaf1e0e3400fb687fde2f401 mods from Christos Zoulas to fit with netbsd-current slcompress stuff --- diff --git a/netbsd-1.2/if_ppp.c b/netbsd-1.2/if_ppp.c index 58b0006..722d245 100644 --- a/netbsd-1.2/if_ppp.c +++ b/netbsd-1.2/if_ppp.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ppp.c,v 1.36 1997/03/04 21:40:07 mycroft Exp $ */ +/* $NetBSD: if_ppp.c,v 1.39 1997/05/17 21:11:59 christos Exp $ */ /* Id: if_ppp.c,v 1.6 1997/03/04 03:33:00 paulus Exp */ /* @@ -234,7 +234,7 @@ pppalloc(pid) MALLOC(sc->sc_comp, struct slcompress *, sizeof(struct slcompress), M_DEVBUF, M_NOWAIT); if (sc->sc_comp) - sl_compress_init(sc->sc_comp, -1); + sl_compress_init(sc->sc_comp); #endif #ifdef PPP_COMPRESS sc->sc_xc_state = NULL; @@ -383,7 +383,7 @@ pppioctl(sc, cmd, data, flag, p) return (error); if (sc->sc_comp) { s = splsoftnet(); - sl_compress_init(sc->sc_comp, *(int *)data); + sl_compress_setup(sc->sc_comp, *(int *)data); splx(s); } break; diff --git a/netbsd-1.2/slcompress.c b/netbsd-1.2/slcompress.c index 9e6346c..96da963 100644 --- a/netbsd-1.2/slcompress.c +++ b/netbsd-1.2/slcompress.c @@ -1,4 +1,4 @@ -/* $NetBSD: slcompress.c,v 1.15 1996/03/15 02:28:12 paulus Exp $ */ +/* $NetBSD: slcompress.c,v 1.17 1997/05/17 21:12:10 christos Exp $ */ /* Id: slcompress.c,v 1.3 1996/05/24 07:04:47 paulus Exp */ /* @@ -67,10 +67,36 @@ #define ovbcopy bcopy #endif + void -sl_compress_init(comp, max_state) +sl_compress_init(comp) struct slcompress *comp; - int max_state; +{ + register u_int i; + register struct cstate *tstate = comp->tstate; + + bzero((char *)comp, sizeof(*comp)); + for (i = MAX_STATES - 1; i > 0; --i) { + tstate[i].cs_id = i; + tstate[i].cs_next = &tstate[i - 1]; + } + tstate[0].cs_next = &tstate[MAX_STATES - 1]; + tstate[0].cs_id = 0; + comp->last_cs = &tstate[0]; + comp->last_recv = 255; + comp->last_xmit = 255; + comp->flags = SLF_TOSS; +} + + +/* + * Like sl_compress_init, but we get to specify the maximum connection + * ID to use on transmission. + */ +void +sl_compress_setup(comp, max_state) + struct slcompress *comp; + int max_state; { register u_int i; register struct cstate *tstate = comp->tstate; diff --git a/netbsd-1.2/slcompress.h b/netbsd-1.2/slcompress.h index f5e0cf7..ca430c4 100644 --- a/netbsd-1.2/slcompress.h +++ b/netbsd-1.2/slcompress.h @@ -1,5 +1,5 @@ -/* $NetBSD: slcompress.h,v 1.9 1995/07/04 06:28:29 paulus Exp $ */ -/* Id: slcompress.h,v 1.1 1995/12/11 05:17:12 paulus Exp */ +/* $NetBSD: slcompress.h,v 1.11 1997/05/17 21:12:11 christos Exp $ */ +/* Id: slcompress.h,v 1.4 1994/09/21 06:50:08 paulus Exp */ /* * Copyright (c) 1989, 1993 @@ -43,6 +43,9 @@ * - Initial distribution. */ +#ifndef _SLCOMPRESS_H_ +#define _SLCOMPRESS_H_ + #define MAX_STATES 16 /* must be > 2 and < 256 */ #define MAX_HDR MLEN /* XXX 4bsd-ism: should really be 128 */ @@ -155,9 +158,12 @@ struct slcompress { /* flag values */ #define SLF_TOSS 1 /* tossing rcvd frames because of input err */ -void sl_compress_init __P((struct slcompress *, int)); -u_int sl_compress_tcp __P((struct mbuf *, - struct ip *, struct slcompress *, int)); -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 *)); +void sl_compress_init __P((struct slcompress *)); +void sl_compress_setup __P((struct slcompress *, int)); +u_int sl_compress_tcp __P((struct mbuf *, + struct ip *, struct slcompress *, int)); +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_ */