]> git.ozlabs.org Git - ppp.git/commitdiff
mods from Christos Zoulas to fit with netbsd-current slcompress stuff
authorPaul Mackerras <paulus@samba.org>
Mon, 14 Jul 1997 03:51:54 +0000 (03:51 +0000)
committerPaul Mackerras <paulus@samba.org>
Mon, 14 Jul 1997 03:51:54 +0000 (03:51 +0000)
netbsd-1.2/if_ppp.c
netbsd-1.2/slcompress.c
netbsd-1.2/slcompress.h

index 58b000607a3f3b32b3a9a2910286cdad823bd9e3..722d2457953f50349cb5b72bcc5174985b5a105e 100644 (file)
@@ -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;
index 9e6346c75fe60e63f8c615bea178ff81e72d5ce3..96da9636463fd2167d272ef98942b0d1e6e7dc3e 100644 (file)
@@ -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   */
 
 /*
 #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;
index f5e0cf7b610b120b2948fe3ef316e110d3c0fbbd..ca430c401d2a05634f6428fdb412672177b87121 100644 (file)
@@ -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_ */