-/* $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 */
/*
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;
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;
-/* $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 */
/*
#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;
-/* $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
* - 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 */
/* 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_ */