summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1997-09-05 04:27:06 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1997-09-05 04:27:06 +0000
commit37097dc262c90509c88f1b095ef6a287b23412b0 (patch)
treef94d1c1d6cc4d116d80eb8916dad7ccbd91f2137
parent3198efbfbe6982841a10db5ae7cd6fc9c6a2a92b (diff)
Minor changes from ppp 2.3.1
-rw-r--r--sys/net/bsd-comp.c6
-rw-r--r--sys/net/if_ppp.c322
-rw-r--r--sys/net/if_ppp.h3
-rw-r--r--sys/net/if_pppvar.h10
-rw-r--r--sys/net/if_sl.c4
-rw-r--r--sys/net/if_strip.c4
-rw-r--r--sys/net/ppp-deflate.c6
-rw-r--r--sys/net/ppp_tty.c409
-rw-r--r--sys/net/slcompress.c57
-rw-r--r--sys/net/slcompress.h22
10 files changed, 426 insertions, 417 deletions
diff --git a/sys/net/bsd-comp.c b/sys/net/bsd-comp.c
index 78a2c37e9fd..28cf3f4ea1a 100644
--- a/sys/net/bsd-comp.c
+++ b/sys/net/bsd-comp.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: bsd-comp.c,v 1.3 1996/04/21 22:28:28 deraadt Exp $ */
-/* $NetBSD: bsd-comp.c,v 1.4 1996/03/15 02:28:00 paulus Exp $ */
+/* $OpenBSD: bsd-comp.c,v 1.4 1997/09/05 04:26:57 millert Exp $ */
+/* $NetBSD: bsd-comp.c,v 1.6 1996/10/13 02:10:58 christos Exp $ */
/* Because this code is derived from the 4.3BSD compress source:
*
@@ -42,8 +42,6 @@
/*
* This version is for use with mbufs on BSD-derived systems.
- *
- * $Id: bsd-comp.c,v 1.3 1996/04/21 22:28:28 deraadt Exp $
*/
#include <sys/param.h>
diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c
index fe64491c173..0e31d45bd13 100644
--- a/sys/net/if_ppp.c
+++ b/sys/net/if_ppp.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: if_ppp.c,v 1.10 1997/01/02 11:10:18 mickey Exp $ */
-/* $NetBSD: if_ppp.c,v 1.31 1996/05/07 02:40:36 thorpej Exp $ */
+/* $OpenBSD: if_ppp.c,v 1.11 1997/09/05 04:26:58 millert Exp $ */
+/* $NetBSD: if_ppp.c,v 1.39 1997/05/17 21:11:59 christos Exp $ */
/*
* if_ppp.c - Point-to-Point Protocol (PPP) Asynchronous driver.
@@ -91,10 +91,6 @@
#include <sys/time.h>
#include <sys/malloc.h>
-#if NetBSD1_0 && defined(i386)
-#include <machine/psl.h>
-#endif
-
#include <net/if.h>
#include <net/if_types.h>
#include <net/netisr.h>
@@ -123,20 +119,17 @@
#include <net/if_pppvar.h>
#include <machine/cpu.h>
-#if NetBSD1_0
-#define splsoftnet splnet
-#endif
-
#ifdef PPP_COMPRESS
#define PACKETPTR struct mbuf *
#include <net/ppp-comp.h>
#endif
-static void ppp_requeue __P((struct ppp_softc *));
-static void ppp_ccp __P((struct ppp_softc *, struct mbuf *m, int rcvd));
-static void ppp_ccp_closed __P((struct ppp_softc *));
-static void ppp_inproc __P((struct ppp_softc *, struct mbuf *));
-static void pppdumpm __P((struct mbuf *m0));
+int pppsioctl __P((struct ifnet *, u_long, caddr_t));
+void ppp_requeue __P((struct ppp_softc *));
+void ppp_ccp __P((struct ppp_softc *, struct mbuf *m, int rcvd));
+void ppp_ccp_closed __P((struct ppp_softc *));
+void ppp_inproc __P((struct ppp_softc *, struct mbuf *));
+void pppdumpm __P((struct mbuf *m0));
/*
* Some useful mbuf macros not in mbuf.h.
@@ -179,6 +172,7 @@ struct compressor *ppp_compressors[8] = {
};
#endif /* PPP_COMPRESS */
+
/*
* Called from boot code to establish ppp interfaces.
*/
@@ -207,19 +201,6 @@ pppattach()
bpfattach(&sc->sc_bpf, &sc->sc_if, DLT_PPP, PPP_HDRLEN);
#endif
}
-
-#if NetBSD1_0 && defined(i386)
- /*
- * XXX kludge to fix the bug in the i386 interrupt handling code,
- * where software interrupts could be taken while hardware
- * interrupts were blocked.
- */
- if ((imask[IPL_TTY] & (1 << SIR_NET)) == 0) {
- imask[IPL_TTY] |= (1 << SIR_NET);
- intr_calculatemasks();
- }
-#endif
-
}
/*
@@ -251,7 +232,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;
@@ -395,9 +376,9 @@ pppioctl(sc, cmd, data, flag, p)
if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
return (error);
if (sc->sc_comp) {
- s = splsoftnet();
- sl_compress_init(sc->sc_comp, *(int *)data);
- splx(s);
+ s = splsoftnet();
+ sl_compress_setup(sc->sc_comp, *(int *)data);
+ splx(s);
}
break;
#endif
@@ -436,7 +417,7 @@ pppioctl(sc, cmd, data, flag, p)
if (sc->sc_xc_state == NULL) {
if (sc->sc_flags & SC_DEBUG)
printf("%s: comp_alloc failed\n",
- sc->sc_if.if_xname);
+ sc->sc_if.if_xname);
error = ENOBUFS;
}
splhigh();
@@ -451,7 +432,7 @@ pppioctl(sc, cmd, data, flag, p)
if (sc->sc_rc_state == NULL) {
if (sc->sc_flags & SC_DEBUG)
printf("%s: decomp_alloc failed\n",
- sc->sc_if.if_xname);
+ sc->sc_if.if_xname);
error = ENOBUFS;
}
splhigh();
@@ -462,8 +443,8 @@ pppioctl(sc, cmd, data, flag, p)
}
if (sc->sc_flags & SC_DEBUG)
printf("%s: no compressor for [%x %x %x], %x\n",
- sc->sc_if.if_xname, ccp_option[0], ccp_option[1],
- ccp_option[2], nb);
+ sc->sc_if.if_xname, ccp_option[0], ccp_option[1],
+ ccp_option[2], nb);
return (EINVAL); /* no handler found */
#endif /* PPP_COMPRESS */
@@ -549,7 +530,7 @@ pppsioctl(ifp, cmd, data)
u_long cmd;
caddr_t data;
{
- struct proc *p = curproc; /* XXX */
+ register struct proc *p = curproc; /* XXX */
register struct ppp_softc *sc = ifp->if_softc;
register struct ifaddr *ifa = (struct ifaddr *)data;
register struct ifreq *ifr = (struct ifreq *)data;
@@ -585,22 +566,22 @@ pppsioctl(ifp, cmd, data)
ifr->ifr_mtu = sc->sc_if.if_mtu;
break;
- case SIOCADDMULTI:
- case SIOCDELMULTI:
+ case SIOCADDMULTI:
+ case SIOCDELMULTI:
if (ifr == 0) {
error = EAFNOSUPPORT;
break;
}
switch(ifr->ifr_addr.sa_family) {
#ifdef INET
- case AF_INET:
- break;
+ case AF_INET:
+ break;
#endif
- default:
- error = EAFNOSUPPORT;
- break;
- }
- break;
+ default:
+ error = EAFNOSUPPORT;
+ break;
+ }
+ break;
case SIOCGPPPSTATS:
psp = &((struct ifpppstatsreq *) data)->stats;
@@ -656,7 +637,7 @@ pppoutput(ifp, m0, dst, rtp)
struct ip *ip;
struct ifqueue *ifq;
enum NPmode mode;
- int active, len;
+ int len;
struct mbuf *m;
if (sc->sc_devp == NULL || (ifp->if_flags & IFF_RUNNING) == 0
@@ -740,12 +721,11 @@ pppoutput(ifp, m0, dst, rtp)
pppdumpm(m0);
}
- /*
- * Apply the pass and active filters to the packet,
- * but only if it is a data packet.
- */
- active = 0;
if ((protocol & 0x8000) == 0) {
+ /*
+ * Apply the pass and active filters to the packet,
+ * but only if it is a data packet.
+ */
*mtod(m0, u_char *) = 1; /* indicates outbound */
if (sc->sc_pass_filt.bf_insns != 0
&& bpf_filter(sc->sc_pass_filt.bf_insns, (u_char *) m0,
@@ -811,7 +791,7 @@ bad:
* npqueue to the send queue or the fast queue as appropriate.
* Should be called at splsoftnet.
*/
-static void
+void
ppp_requeue(sc)
struct ppp_softc *sc;
{
@@ -873,7 +853,6 @@ ppp_restart(sc)
splx(s);
}
-
/*
* Get a packet to send. This procedure is intended to be called at
* splsoftnet, since it may involve time-consuming operations such as
@@ -888,126 +867,126 @@ ppp_dequeue(sc)
u_char *cp;
int address, control, protocol;
int s = splhigh();
-
+
/*
* Grab a packet to send: first try the fast queue, then the
* normal queue.
*/
IF_DEQUEUE(&sc->sc_fastq, m);
- if (m == NULL)
- IF_DEQUEUE(&sc->sc_if.if_snd, m);
if (m == NULL)
- { splx(s);
- return NULL;
+ IF_DEQUEUE(&sc->sc_if.if_snd, m);
+ if (m == NULL) {
+ splx(s);
+ return NULL;
}
-
+
++sc->sc_stats.ppp_opackets;
/*
* Extract the ppp header of the new packet.
- * The ppp header will be in one mbuf.
+ * The ppp header will be in one mbuf.
*/
cp = mtod(m, u_char *);
address = PPP_ADDRESS(cp);
control = PPP_CONTROL(cp);
protocol = PPP_PROTOCOL(cp);
-
+
switch (protocol) {
case PPP_IP:
#ifdef VJC
- /*
- * If the packet is a TCP/IP packet, see if we can compress it.
- */
- if ((sc->sc_flags & SC_COMP_TCP) && sc->sc_comp != NULL) {
- struct ip *ip;
- int type;
-
- mp = m;
- ip = (struct ip *) (cp + PPP_HDRLEN);
- if (mp->m_len <= PPP_HDRLEN) {
- mp = mp->m_next;
- if (mp == NULL)
- break;
- ip = mtod(mp, struct ip *);
- }
- /* this code assumes the IP/TCP header is in one non-shared mbuf */
- if (ip->ip_p == IPPROTO_TCP) {
- type = sl_compress_tcp(mp, ip, sc->sc_comp,
- !(sc->sc_flags & SC_NO_TCP_CCID));
- switch (type) {
- case TYPE_UNCOMPRESSED_TCP:
- protocol = PPP_VJC_UNCOMP;
- break;
- case TYPE_COMPRESSED_TCP:
- protocol = PPP_VJC_COMP;
- cp = mtod(m, u_char *);
- cp[0] = address; /* header has moved */
- cp[1] = control;
- cp[2] = 0;
- break;
- }
- cp[3] = protocol; /* update protocol in PPP header */
- }
- }
-#endif /* VJC */
- break;
-
+ /*
+ * If the packet is a TCP/IP packet, see if we can compress it.
+ */
+ if ((sc->sc_flags & SC_COMP_TCP) && sc->sc_comp != NULL) {
+ struct ip *ip;
+ int type;
+
+ mp = m;
+ ip = (struct ip *) (cp + PPP_HDRLEN);
+ if (mp->m_len <= PPP_HDRLEN) {
+ mp = mp->m_next;
+ if (mp == NULL)
+ break;
+ ip = mtod(mp, struct ip *);
+ }
+ /* this code assumes the IP/TCP header is in one non-shared mbuf */
+ if (ip->ip_p == IPPROTO_TCP) {
+ type = sl_compress_tcp(mp, ip, sc->sc_comp,
+ !(sc->sc_flags & SC_NO_TCP_CCID));
+ switch (type) {
+ case TYPE_UNCOMPRESSED_TCP:
+ protocol = PPP_VJC_UNCOMP;
+ break;
+ case TYPE_COMPRESSED_TCP:
+ protocol = PPP_VJC_COMP;
+ cp = mtod(m, u_char *);
+ cp[0] = address; /* header has moved */
+ cp[1] = control;
+ cp[2] = 0;
+ break;
+ }
+ cp[3] = protocol; /* update protocol in PPP header */
+ }
+ }
+#endif /* VJC */
+ break;
+
#ifdef PPP_COMPRESS
case PPP_CCP:
- ppp_ccp(sc, m, 0);
- break;
-#endif /* PPP_COMPRESS */
+ ppp_ccp(sc, m, 0);
+ break;
+#endif /* PPP_COMPRESS */
}
-
+
#ifdef PPP_COMPRESS
if (protocol != PPP_LCP && protocol != PPP_CCP
- && sc->sc_xc_state && (sc->sc_flags & SC_COMP_RUN)) {
- struct mbuf *mcomp = NULL;
- int slen, clen;
-
- slen = 0;
- for (mp = m; mp != NULL; mp = mp->m_next)
- slen += mp->m_len;
- clen = (*sc->sc_xcomp->compress)
- (sc->sc_xc_state, &mcomp, m, slen,
- (sc->sc_flags & SC_CCP_UP? sc->sc_if.if_mtu + PPP_HDRLEN: 0));
- if (mcomp != NULL) {
- if (sc->sc_flags & SC_CCP_UP) {
- /* Send the compressed packet instead of the original. */
- m_freem(m);
- m = mcomp;
- cp = mtod(m, u_char *);
- protocol = cp[3];
- } else {
- /* Can't transmit compressed packets until CCP is up. */
- m_freem(mcomp);
- }
- }
+ && sc->sc_xc_state && (sc->sc_flags & SC_COMP_RUN)) {
+ struct mbuf *mcomp = NULL;
+ int slen, clen;
+
+ slen = 0;
+ for (mp = m; mp != NULL; mp = mp->m_next)
+ slen += mp->m_len;
+ clen = (*sc->sc_xcomp->compress)
+ (sc->sc_xc_state, &mcomp, m, slen,
+ (sc->sc_flags & SC_CCP_UP ? sc->sc_if.if_mtu + PPP_HDRLEN : 0));
+ if (mcomp != NULL) {
+ if (sc->sc_flags & SC_CCP_UP) {
+ /* Send the compressed packet instead of the original. */
+ m_freem(m);
+ m = mcomp;
+ cp = mtod(m, u_char *);
+ protocol = cp[3];
+ } else {
+ /* Can't transmit compressed packets until CCP is up. */
+ m_freem(mcomp);
+ }
+ }
}
-#endif /* PPP_COMPRESS */
-
+#endif /* PPP_COMPRESS */
+
/*
* Compress the address/control and protocol, if possible.
*/
if (sc->sc_flags & SC_COMP_AC && address == PPP_ALLSTATIONS &&
- control == PPP_UI && protocol != PPP_ALLSTATIONS &&
- protocol != PPP_LCP) {
- /* can compress address/control */
- m->m_data += 2;
- m->m_len -= 2;
- }
+ control == PPP_UI && protocol != PPP_ALLSTATIONS &&
+ protocol != PPP_LCP) {
+ /* can compress address/control */
+ m->m_data += 2;
+ m->m_len -= 2;
+ }
if (sc->sc_flags & SC_COMP_PROT && protocol < 0xFF) {
- /* can compress protocol */
- if (mtod(m, u_char *) == cp) {
- cp[2] = cp[1]; /* move address/control up */
- cp[1] = cp[0];
- }
- ++m->m_data;
- --m->m_len;
+ /* can compress protocol */
+ if (mtod(m, u_char *) == cp) {
+ cp[2] = cp[1]; /* move address/control up */
+ cp[1] = cp[0];
+ }
+ ++m->m_data;
+ --m->m_len;
}
- splx(s);
+
+ splx(s);
return m;
-
}
/*
@@ -1019,38 +998,35 @@ pppintr()
struct ppp_softc *sc;
int i, s, s2;
struct mbuf *m;
-
+
sc = ppp_softc;
- s = splsoftnet();
+ s = splsoftnet();
for (i = 0; i < NPPP; ++i, ++sc) {
- if (!(sc->sc_flags & SC_TBUSY)
- && (sc->sc_if.if_snd.ifq_head || sc->sc_fastq.ifq_head)) {
- s2 = splimp();
- sc->sc_flags |= SC_TBUSY;
- splx(s2);
- (*sc->sc_start)(sc);
- }
- for (;;) {
- s2 = splimp();
- IF_DEQUEUE(&sc->sc_rawq, m);
- splx(s2);
- if (m == NULL)
- break;
- ppp_inproc(sc, m);
- }
+ if (!(sc->sc_flags & SC_TBUSY)
+ && (sc->sc_if.if_snd.ifq_head || sc->sc_fastq.ifq_head)) {
+ s2 = splimp();
+ sc->sc_flags |= SC_TBUSY;
+ splx(s2);
+ (*sc->sc_start)(sc);
+ }
+ for (;;) {
+ s2 = splimp();
+ IF_DEQUEUE(&sc->sc_rawq, m);
+ splx(s2);
+ if (m == NULL)
+ break;
+ ppp_inproc(sc, m);
+ }
}
splx(s);
-
}
-
-
#ifdef PPP_COMPRESS
/*
* Handle a CCP packet. `rcvd' is 1 if the packet was received,
* 0 if it is about to be transmitted.
*/
-static void
+void
ppp_ccp(sc, m, rcvd)
struct ppp_softc *sc;
struct mbuf *m;
@@ -1080,7 +1056,7 @@ ppp_ccp(sc, m, rcvd)
if (dp + slen > ep) {
if (sc->sc_flags & SC_DEBUG)
printf("if_ppp/ccp: not enough data in mbuf (%p+%x > %p+%x)\n",
- dp, slen, mtod(mp, u_char *), mp->m_len);
+ dp, slen, mtod(mp, u_char *), mp->m_len);
return;
}
@@ -1147,7 +1123,7 @@ ppp_ccp(sc, m, rcvd)
/*
* CCP is down; free (de)compressor state if necessary.
*/
-static void
+void
ppp_ccp_closed(sc)
struct ppp_softc *sc;
{
@@ -1190,7 +1166,7 @@ ppppktin(sc, m, lost)
#define COMPTYPE(proto) ((proto) == PPP_VJC_COMP? TYPE_COMPRESSED_TCP: \
TYPE_UNCOMPRESSED_TCP)
-static void
+void
ppp_inproc(sc, m)
struct ppp_softc *sc;
struct mbuf *m;
@@ -1302,7 +1278,7 @@ ppp_inproc(sc, m)
if (xlen <= 0) {
if (sc->sc_flags & SC_DEBUG)
printf("%s: VJ uncompress failed on type comp\n",
- ifp->if_xname);
+ ifp->if_xname);
goto bad;
}
@@ -1354,7 +1330,7 @@ ppp_inproc(sc, m)
if (xlen < 0) {
if (sc->sc_flags & SC_DEBUG)
printf("%s: VJ uncompress failed on type uncomp\n",
- ifp->if_xname);
+ ifp->if_xname);
goto bad;
}
@@ -1379,11 +1355,11 @@ ppp_inproc(sc, m)
m->m_pkthdr.len = ilen;
m->m_pkthdr.rcvif = ifp;
- /*
- * See whether we want to pass this packet, and
- * if it counts as link activity.
- */
if ((proto & 0x8000) == 0) {
+ /*
+ * See whether we want to pass this packet, and
+ * if it counts as link activity.
+ */
adrs = *mtod(m, u_char *); /* save address field */
*mtod(m, u_char *) = 0; /* indicate inbound */
if (sc->sc_pass_filt.bf_insns != 0
@@ -1467,7 +1443,7 @@ ppp_inproc(sc, m)
#define MAX_DUMP_BYTES 128
-static void
+void
pppdumpm(m0)
struct mbuf *m0;
{
diff --git a/sys/net/if_ppp.h b/sys/net/if_ppp.h
index e6a2eb0daa0..00eef54d77b 100644
--- a/sys/net/if_ppp.h
+++ b/sys/net/if_ppp.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ppp.h,v 1.3 1996/04/21 22:28:33 deraadt Exp $ */
+/* $OpenBSD: if_ppp.h,v 1.4 1997/09/05 04:26:59 millert Exp $ */
/* $NetBSD: if_ppp.h,v 1.11 1996/03/15 02:28:05 paulus Exp $ */
/*
@@ -132,7 +132,6 @@ struct ifpppcstatsreq {
#ifdef _KERNEL
void pppattach __P((void));
-int pppsioctl __P((struct ifnet *, u_long, caddr_t));
int pppoutput __P((struct ifnet *, struct mbuf *, struct sockaddr *,
struct rtentry *));
void pppintr __P((void));
diff --git a/sys/net/if_pppvar.h b/sys/net/if_pppvar.h
index 616b5504805..98f524fe68f 100644
--- a/sys/net/if_pppvar.h
+++ b/sys/net/if_pppvar.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: if_pppvar.h,v 1.5 1997/02/24 13:34:00 niklas Exp $ */
-/* $NetBSD: if_pppvar.h,v 1.4 1996/05/07 02:40:39 thorpej Exp $ */
+/* $OpenBSD: if_pppvar.h,v 1.6 1997/09/05 04:27:00 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.
*
@@ -82,7 +82,7 @@ struct ppp_softc {
#ifdef VJC
struct slcompress *sc_comp; /* vjc control buffer */
#endif
-
+
/* Device-dependent part for async lines. */
ext_accm sc_asyncmap; /* async control character map */
u_int32_t sc_rasyncmap; /* receive async control char map */
@@ -97,6 +97,7 @@ struct ppp_softc {
int sc_rawin_count; /* # in sc_rawin */
};
+#ifdef _KERNEL
struct ppp_softc ppp_softc[NPPP];
struct ppp_softc *pppalloc __P((pid_t pid));
@@ -106,3 +107,6 @@ int pppioctl __P((struct ppp_softc *sc, u_long cmd, caddr_t data,
void ppppktin __P((struct ppp_softc *sc, struct mbuf *m, int lost));
struct mbuf *ppp_dequeue __P((struct ppp_softc *sc));
void ppp_restart __P((struct ppp_softc *sc));
+int pppoutput __P((struct ifnet *, struct mbuf *,
+ struct sockaddr *, struct rtentry *));
+#endif /* _KERNEL */
diff --git a/sys/net/if_sl.c b/sys/net/if_sl.c
index 865626681df..5a6579cabf7 100644
--- a/sys/net/if_sl.c
+++ b/sys/net/if_sl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_sl.c,v 1.7 1996/08/22 00:35:52 deraadt Exp $ */
+/* $OpenBSD: if_sl.c,v 1.8 1997/09/05 04:27:01 millert Exp $ */
/* $NetBSD: if_sl.c,v 1.39.4.1 1996/06/02 16:26:31 thorpej Exp $ */
/*
@@ -238,7 +238,7 @@ slinit(sc)
}
sc->sc_buf = sc->sc_ep - SLMAX;
sc->sc_mp = sc->sc_buf;
- sl_compress_init(&sc->sc_comp, -1);
+ sl_compress_init(&sc->sc_comp);
return (1);
}
diff --git a/sys/net/if_strip.c b/sys/net/if_strip.c
index 35a39aec185..7516d4f4167 100644
--- a/sys/net/if_strip.c
+++ b/sys/net/if_strip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_strip.c,v 1.8 1997/06/20 09:30:55 deraadt Exp $ */
+/* $OpenBSD: if_strip.c,v 1.9 1997/09/05 04:27:02 millert Exp $ */
/* $NetBSD: if_strip.c,v 1.2.4.3 1996/08/03 00:58:32 jtc Exp $ */
/* from: NetBSD: if_sl.c,v 1.38 1996/02/13 22:00:23 christos Exp $ */
@@ -417,7 +417,7 @@ stripinit(sc)
sc->sc_buf = sc->sc_ep - SLMAX;
sc->sc_mp = sc->sc_buf;
- sl_compress_init(&sc->sc_comp, -1);
+ sl_compress_init(&sc->sc_comp);
/* Initialize radio probe/reset state machine */
sc->sc_state = ST_DEAD; /* assumet the worst. */
diff --git a/sys/net/ppp-deflate.c b/sys/net/ppp-deflate.c
index ee90c41029c..3a01d20836f 100644
--- a/sys/net/ppp-deflate.c
+++ b/sys/net/ppp-deflate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ppp-deflate.c,v 1.3 1997/02/24 13:34:04 niklas Exp $ */
+/* $OpenBSD: ppp-deflate.c,v 1.4 1997/09/05 04:27:03 millert Exp $ */
/* $NetBSD: ppp-deflate.c,v 1.1 1996/03/15 02:28:09 paulus Exp $ */
/*
@@ -583,8 +583,8 @@ z_decompress(arg, mi, mop)
olen += (mo->m_len = ospace - state->strm.avail_out);
#ifdef DEFLATE_DEBUG
if (olen > state->mru + PPP_HDRLEN)
- printf("ppp_deflate%d: exceeded mru (%d > %d)\n",
- state->unit, olen, state->mru + PPP_HDRLEN);
+ printf("ppp_deflate%d: exceeded mru (%d > %d)\n",
+ state->unit, olen, state->mru + PPP_HDRLEN);
#endif
state->stats.unc_bytes += olen;
diff --git a/sys/net/ppp_tty.c b/sys/net/ppp_tty.c
index 7a79277b535..537547d5aaa 100644
--- a/sys/net/ppp_tty.c
+++ b/sys/net/ppp_tty.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: ppp_tty.c,v 1.6 1997/01/15 03:19:24 kstailey Exp $ */
-/* $NetBSD: ppp_tty.c,v 1.6 1996/05/07 02:40:51 thorpej Exp $ */
+/* $OpenBSD: ppp_tty.c,v 1.7 1997/09/05 04:27:03 millert Exp $ */
+/* $NetBSD: ppp_tty.c,v 1.12 1997/03/24 21:23:10 christos Exp $ */
/*
* ppp_tty.c - Point-to-Point Protocol (PPP) driver for asynchronous
@@ -117,16 +117,16 @@ int pppwrite __P((struct tty *tp, struct uio *uio, int flag));
int ppptioctl __P((struct tty *tp, u_long cmd, caddr_t data, int flag,
struct proc *));
int pppinput __P((int c, struct tty *tp));
-int pppstart __P((struct tty *tp));
+int pppstart __P((struct tty *tp, int));
-static u_int16_t pppfcs __P((u_int16_t fcs, u_char *cp, int len));
-static void pppasyncstart __P((struct ppp_softc *));
-static void pppasyncctlp __P((struct ppp_softc *));
-static void pppasyncrelinq __P((struct ppp_softc *));
-static void ppp_timeout __P((void *));
-static void pppgetm __P((struct ppp_softc *sc));
-static void pppdumpb __P((u_char *b, int l));
-static void ppplogchar __P((struct ppp_softc *, int));
+u_int16_t pppfcs __P((u_int16_t fcs, u_char *cp, int len));
+void pppasyncstart __P((struct ppp_softc *));
+void pppasyncctlp __P((struct ppp_softc *));
+void pppasyncrelinq __P((struct ppp_softc *));
+void ppp_timeout __P((void *));
+void pppgetm __P((struct ppp_softc *sc));
+void pppdumpb __P((u_char *b, int l));
+void ppplogchar __P((struct ppp_softc *, int));
/*
* Some useful mbuf macros not in mbuf.h.
@@ -153,7 +153,7 @@ static void ppplogchar __P((struct ppp_softc *, int));
/* This is a NetBSD-1.0 or later kernel. */
#define CCOUNT(q) ((q)->c_cc)
-#define PPP_LOWAT 100 /* Process more output when < LOWAT on queue */
+#define PPP_LOWAT 100 /* Process more output when < LOWAT on queue */
#define PPP_HIWAT 400 /* Don't start a new packet if HIWAT on que */
/*
@@ -246,7 +246,7 @@ pppclose(tp, flag)
/*
* Relinquish the interface unit to another device.
*/
-static void
+void
pppasyncrelinq(sc)
struct ppp_softc *sc;
{
@@ -371,7 +371,7 @@ pppwrite(tp, uio, flag)
bcopy(mtod(m0, u_char *), dst.sa_data, PPP_HDRLEN);
m0->m_data += PPP_HDRLEN;
m0->m_len -= PPP_HDRLEN;
- return (pppoutput(&sc->sc_if, m0, &dst, (struct rtentry *)0));
+ return ((*sc->sc_if.if_output)(&sc->sc_if, m0, &dst, (struct rtentry *)0));
}
/*
@@ -481,7 +481,7 @@ static u_int16_t fcstab[256] = {
/*
* Calculate a new FCS given the current FCS and the new data.
*/
-static u_int16_t
+u_int16_t
pppfcs(fcs, cp, len)
register u_int16_t fcs;
register u_char *cp;
@@ -496,7 +496,7 @@ pppfcs(fcs, cp, len)
* This gets called from pppoutput when a new packet is
* put on a queue, at splsoftnet.
*/
-static void
+void
pppasyncstart(sc)
register struct ppp_softc *sc;
{
@@ -507,180 +507,181 @@ pppasyncstart(sc)
int n, ndone, done, idle;
struct mbuf *m2;
int s;
-
+
idle = 0;
while (CCOUNT(&tp->t_outq) < PPP_HIWAT) {
- /*
- * See if we have an existing packet partly sent.
- * If not, get a new packet and start sending it.
- */
- m = sc->sc_outm;
- if (m == NULL) {
- /*
- * Get another packet to be sent.
- */
- m = ppp_dequeue(sc);
- if (m == NULL) {
- idle = 1;
- break;
- }
-
- /*
- * The extra PPP_FLAG will start up a new packet, and thus
- * will flush any accumulated garbage. We do this whenever
- * the line may have been idle for some time.
- */
- if (CCOUNT(&tp->t_outq) == 0) {
- ++sc->sc_stats.ppp_obytes;
- (void) putc(PPP_FLAG, &tp->t_outq);
- }
-
- /* Calculate the FCS for the first mbuf's worth. */
- sc->sc_outfcs = pppfcs(PPP_INITFCS, mtod(m, u_char *), m->m_len);
- sc->sc_if.if_lastchange = time;
- }
-
- for (;;) {
- start = mtod(m, u_char *);
- len = m->m_len;
- stop = start + len;
- while (len > 0) {
- /*
- * Find out how many bytes in the string we can
- * handle without doing something special.
- */
- for (cp = start; cp < stop; cp++)
- if (ESCAPE_P(*cp))
- break;
- n = cp - start;
- if (n) {
- /* NetBSD (0.9 or later), 4.3-Reno or similar. */
- ndone = n - b_to_q(start, n, &tp->t_outq);
- len -= ndone;
- start += ndone;
- sc->sc_stats.ppp_obytes += ndone;
-
- if (ndone < n)
- break; /* packet doesn't fit */
- }
- /*
- * If there are characters left in the mbuf,
- * the first one must be special.
- * Put it out in a different form.
- */
- if (len) {
- s = spltty();
- if (putc(PPP_ESCAPE, &tp->t_outq))
- break;
- if (putc(*start ^ PPP_TRANS, &tp->t_outq)) {
- (void) unputc(&tp->t_outq);
- splx(s);
- break;
- }
- splx(s);
- sc->sc_stats.ppp_obytes += 2;
- start++;
- len--;
- }
- }
-
- /*
- * If we didn't empty this mbuf, remember where we're up to.
- * If we emptied the last mbuf, try to add the FCS and closing
- * flag, and if we can't, leave sc_outm pointing to m, but with
- * m->m_len == 0, to remind us to output the FCS and flag later.
- */
- done = len == 0;
- if (done && m->m_next == NULL) {
- u_char *p, *q;
- int c;
- u_char endseq[8];
-
- /*
- * We may have to escape the bytes in the FCS.
- */
- p = endseq;
- c = ~sc->sc_outfcs & 0xFF;
- if (ESCAPE_P(c)) {
- *p++ = PPP_ESCAPE;
- *p++ = c ^ PPP_TRANS;
- } else
- *p++ = c;
- c = (~sc->sc_outfcs >> 8) & 0xFF;
- if (ESCAPE_P(c)) {
- *p++ = PPP_ESCAPE;
- *p++ = c ^ PPP_TRANS;
- } else
- *p++ = c;
- *p++ = PPP_FLAG;
-
- /*
- * Try to output the FCS and flag. If the bytes
- * don't all fit, back out.
- */
- s = spltty();
- for (q = endseq; q < p; ++q)
- if (putc(*q, &tp->t_outq)) {
- done = 0;
- for (; q > endseq; --q)
- unputc(&tp->t_outq);
- break;
- }
- splx(s);
- if (done)
- sc->sc_stats.ppp_obytes += q - endseq;
- }
-
- if (!done) {
- /* remember where we got to */
- m->m_data = start;
- m->m_len = len;
- break;
- }
-
- /* Finished with this mbuf; free it and move on. */
- MFREE(m, m2);
- m = m2;
- if (m == NULL) {
- /* Finished a packet */
- break;
- }
- sc->sc_outfcs = pppfcs(sc->sc_outfcs, mtod(m, u_char *), m->m_len);
- }
-
- /*
- * If m == NULL, we have finished a packet.
- * If m != NULL, we've either done as much work this time
- * as we need to, or else we've filled up the output queue.
- */
- sc->sc_outm = m;
- if (m)
- break;
+ /*
+ * See if we have an existing packet partly sent.
+ * If not, get a new packet and start sending it.
+ */
+ m = sc->sc_outm;
+ if (m == NULL) {
+ /*
+ * Get another packet to be sent.
+ */
+ m = ppp_dequeue(sc);
+ if (m == NULL) {
+ idle = 1;
+ break;
+ }
+
+ /*
+ * The extra PPP_FLAG will start up a new packet, and thus
+ * will flush any accumulated garbage. We do this whenever
+ * the line may have been idle for some time.
+ */
+ if (CCOUNT(&tp->t_outq) == 0) {
+ ++sc->sc_stats.ppp_obytes;
+ (void) putc(PPP_FLAG, &tp->t_outq);
+ }
+
+ /* Calculate the FCS for the first mbuf's worth. */
+ sc->sc_outfcs = pppfcs(PPP_INITFCS, mtod(m, u_char *), m->m_len);
+ sc->sc_if.if_lastchange = time;
+ }
+
+ for (;;) {
+ start = mtod(m, u_char *);
+ len = m->m_len;
+ stop = start + len;
+ while (len > 0) {
+ /*
+ * Find out how many bytes in the string we can
+ * handle without doing something special.
+ */
+ for (cp = start; cp < stop; cp++)
+ if (ESCAPE_P(*cp))
+ break;
+ n = cp - start;
+ if (n) {
+ /* NetBSD (0.9 or later), 4.3-Reno or similar. */
+ ndone = n - b_to_q(start, n, &tp->t_outq);
+ len -= ndone;
+ start += ndone;
+ sc->sc_stats.ppp_obytes += ndone;
+
+ if (ndone < n)
+ break; /* packet doesn't fit */
+ }
+ /*
+ * If there are characters left in the mbuf,
+ * the first one must be special.
+ * Put it out in a different form.
+ */
+ if (len) {
+ s = spltty();
+ if (putc(PPP_ESCAPE, &tp->t_outq)) {
+ splx(s);
+ break;
+ }
+ if (putc(*start ^ PPP_TRANS, &tp->t_outq)) {
+ (void) unputc(&tp->t_outq);
+ splx(s);
+ break;
+ }
+ splx(s);
+ sc->sc_stats.ppp_obytes += 2;
+ start++;
+ len--;
+ }
+ }
+
+ /*
+ * If we didn't empty this mbuf, remember where we're up to.
+ * If we emptied the last mbuf, try to add the FCS and closing
+ * flag, and if we can't, leave sc_outm pointing to m, but with
+ * m->m_len == 0, to remind us to output the FCS and flag later.
+ */
+ done = len == 0;
+ if (done && m->m_next == NULL) {
+ u_char *p, *q;
+ int c;
+ u_char endseq[8];
+
+ /*
+ * We may have to escape the bytes in the FCS.
+ */
+ p = endseq;
+ c = ~sc->sc_outfcs & 0xFF;
+ if (ESCAPE_P(c)) {
+ *p++ = PPP_ESCAPE;
+ *p++ = c ^ PPP_TRANS;
+ } else
+ *p++ = c;
+ c = (~sc->sc_outfcs >> 8) & 0xFF;
+ if (ESCAPE_P(c)) {
+ *p++ = PPP_ESCAPE;
+ *p++ = c ^ PPP_TRANS;
+ } else
+ *p++ = c;
+ *p++ = PPP_FLAG;
+
+ /*
+ * Try to output the FCS and flag. If the bytes
+ * don't all fit, back out.
+ */
+ s = spltty();
+ for (q = endseq; q < p; ++q)
+ if (putc(*q, &tp->t_outq)) {
+ done = 0;
+ for (; q > endseq; --q)
+ unputc(&tp->t_outq);
+ break;
+ }
+ splx(s);
+ if (done)
+ sc->sc_stats.ppp_obytes += q - endseq;
+ }
+
+ if (!done) {
+ /* remember where we got to */
+ m->m_data = start;
+ m->m_len = len;
+ break;
+ }
+
+ /* Finished with this mbuf; free it and move on. */
+ MFREE(m, m2);
+ m = m2;
+ if (m == NULL) {
+ /* Finished a packet */
+ break;
+ }
+ sc->sc_outfcs = pppfcs(sc->sc_outfcs, mtod(m, u_char *), m->m_len);
+ }
+
+ /*
+ * If m == NULL, we have finished a packet.
+ * If m != NULL, we've either done as much work this time
+ * as we need to, or else we've filled up the output queue.
+ */
+ sc->sc_outm = m;
+ if (m)
+ break;
}
-
+
/* Call pppstart to start output again if necessary. */
s = spltty();
- pppstart(tp);
-
- /*
- * This timeout is needed for operation on a pseudo-tty,
+ pppstart(tp, 0);
+
+ /*
+ * This timeout is needed for operation on a pseudo-tty,
* because the pty code doesn't call pppstart after it has
* drained the t_outq.
*/
if (!idle && (sc->sc_flags & SC_TIMEOUT) == 0) {
- timeout(ppp_timeout, (void *) sc, 1);
- sc->sc_flags |= SC_TIMEOUT;
+ timeout(ppp_timeout, (void *) sc, 1);
+ sc->sc_flags |= SC_TIMEOUT;
}
-
- splx(s);
-
+
+ splx(s);
}
/*
* This gets called when a received packet is placed on
* the inq, at splsoftnet.
*/
-static void
+void
pppasyncctlp(sc)
struct ppp_softc *sc;
{
@@ -696,42 +697,42 @@ pppasyncctlp(sc)
}
/*
- * Start output on async tty interface. Get another datagram
- * to send from the interface queue and start sending it.
- * Called at spltty or higher.
- */
+ * Start output on async tty interface. If the transmit queue
+ * has drained sufficiently, arrange for pppasyncstart to be
+ * called later at splsoftnet.
+ */
int
-pppstart(tp)
+pppstart(tp, force)
register struct tty *tp;
+ int force;
{
register struct ppp_softc *sc = (struct ppp_softc *) tp->t_sc;
-
+
/*
* If there is stuff in the output queue, send it now.
* We are being called in lieu of ttstart and must do what it would.
*/
if (tp->t_oproc != NULL)
- (*tp->t_oproc)(tp);
+ (*tp->t_oproc)(tp);
/*
* If the transmit queue has drained and the tty has not hung up
* or been disconnected from the ppp unit, then tell if_ppp.c that
* we need more output.
*/
- if (CCOUNT(&tp->t_outq) < PPP_LOWAT
- && !((tp->t_state & TS_CARR_ON) == 0 && (tp->t_cflag & CLOCAL) == 0)
- && sc != NULL && tp == (struct tty *) sc->sc_devp) {
- ppp_restart(sc);
+ if ((CCOUNT(&tp->t_outq) < PPP_LOWAT || force)
+ && !((tp->t_state & TS_CARR_ON) == 0 && (tp->t_cflag & CLOCAL) == 0)
+ && sc != NULL && tp == (struct tty *) sc->sc_devp) {
+ ppp_restart(sc);
}
-
- return 0;
-}
+ return 0;
+}
/*
* Timeout routine - try to start some more output.
*/
-static void
+void
ppp_timeout(x)
void *x;
{
@@ -741,14 +742,14 @@ ppp_timeout(x)
s = spltty();
sc->sc_flags &= ~SC_TIMEOUT;
- pppstart(tp);
+ pppstart(tp, 1);
splx(s);
}
/*
* Allocate enough mbuf to handle current MRU.
*/
-static void
+void
pppgetm(sc)
register struct ppp_softc *sc;
{
@@ -833,8 +834,8 @@ pppinput(c, tp)
sc->sc_flags |= SC_RCV_ODDP;
else
sc->sc_flags |= SC_RCV_EVNP;
-
splx(s);
+
if (sc->sc_flags & SC_LOG_RAWIN)
ppplogchar(sc, c);
@@ -842,7 +843,7 @@ pppinput(c, tp)
ilen = sc->sc_ilen;
sc->sc_ilen = 0;
- if (sc->sc_rawin_count > 0)
+ if (sc->sc_rawin_count > 0)
ppplogchar(sc, -1);
/*
@@ -856,7 +857,7 @@ pppinput(c, tp)
if ((sc->sc_flags & (SC_FLUSH | SC_ESCAPED)) == 0){
if (sc->sc_flags & SC_DEBUG)
printf("%s: bad fcs %x\n", sc->sc_if.if_xname,
- sc->sc_fcs);
+ sc->sc_fcs);
sc->sc_if.if_ierrors++;
sc->sc_stats.ppp_ierrors++;
} else
@@ -869,10 +870,11 @@ pppinput(c, tp)
if (ilen) {
if (sc->sc_flags & SC_DEBUG)
printf("%s: too short (%d)\n", sc->sc_if.if_xname, ilen);
+ s = spltty();
sc->sc_if.if_ierrors++;
sc->sc_stats.ppp_ierrors++;
sc->sc_flags |= SC_PKTLOST;
- splx(s);
+ splx(s);
}
return 0;
}
@@ -894,8 +896,8 @@ pppinput(c, tp)
sc->sc_mc->m_next = NULL;
ppppktin(sc, m, sc->sc_flags & SC_PKTLOST);
- if (sc->sc_flags & SC_PKTLOST) {
- s = spltty();
+ if (sc->sc_flags & SC_PKTLOST) {
+ s = spltty();
sc->sc_flags &= ~SC_PKTLOST;
splx(s);
}
@@ -910,9 +912,8 @@ pppinput(c, tp)
return 0;
}
- if (c < 0x20 && (sc->sc_rasyncmap & (1 << c))) {
+ if (c < 0x20 && (sc->sc_rasyncmap & (1 << c)))
return 0;
- }
s = spltty();
if (sc->sc_flags & SC_ESCAPED) {
@@ -954,7 +955,7 @@ pppinput(c, tp)
if (sc->sc_flags & SC_REJ_COMP_AC) {
if (sc->sc_flags & SC_DEBUG)
printf("%s: garbage received: 0x%x (need 0xFF)\n",
- sc->sc_if.if_xname, c);
+ sc->sc_if.if_xname, c);
goto flush;
}
*sc->sc_mp++ = PPP_ALLSTATIONS;
@@ -966,7 +967,7 @@ pppinput(c, tp)
if (sc->sc_ilen == 1 && c != PPP_UI) {
if (sc->sc_flags & SC_DEBUG)
printf("%s: missing UI (0x3), got 0x%x\n",
- sc->sc_if.if_xname, c);
+ sc->sc_if.if_xname, c);
goto flush;
}
if (sc->sc_ilen == 2 && (c & 1) == 1) {
@@ -978,7 +979,7 @@ pppinput(c, tp)
if (sc->sc_ilen == 3 && (c & 1) == 0) {
if (sc->sc_flags & SC_DEBUG)
printf("%s: bad protocol %x\n", sc->sc_if.if_xname,
- (sc->sc_mp[-1] << 8) + c);
+ (sc->sc_mp[-1] << 8) + c);
goto flush;
}
@@ -1028,7 +1029,7 @@ pppinput(c, tp)
#define MAX_DUMP_BYTES 128
-static void
+void
ppplogchar(sc, c)
struct ppp_softc *sc;
int c;
@@ -1043,7 +1044,7 @@ ppplogchar(sc, c)
}
}
-static void
+void
pppdumpb(b, l)
u_char *b;
int l;
diff --git a/sys/net/slcompress.c b/sys/net/slcompress.c
index 8601bbd06c7..c1d0121504c 100644
--- a/sys/net/slcompress.c
+++ b/sys/net/slcompress.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: slcompress.c,v 1.5 1996/07/25 14:20:52 joshd Exp $ */
-/* $NetBSD: slcompress.c,v 1.15 1996/03/15 02:28:12 paulus Exp $ */
+/* $OpenBSD: slcompress.c,v 1.6 1997/09/05 04:27:04 millert Exp $ */
+/* $NetBSD: slcompress.c,v 1.17 1997/05/17 21:12:10 christos Exp $ */
/*
* Copyright (c) 1989, 1993, 1994
@@ -67,17 +67,43 @@
#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;
if (max_state == -1) {
max_state = MAX_STATES - 1;
- bzero((char *)comp, sizeof(*comp));
+ bzero((char *)comp, sizeof(*comp));
} else {
/* Don't reset statistics */
bzero((char *)comp->tstate, sizeof(comp->tstate));
@@ -478,17 +504,16 @@ sl_uncompress_tcp_core(buf, buflen, total_len, type, comp, hdrp, hlenp)
cs = &comp->rstate[comp->last_recv = ip->ip_p];
comp->flags &=~ SLF_TOSS;
ip->ip_p = IPPROTO_TCP;
- /*
- * Calculate the size of the TCP/IP header and make sure that
- * we don't overflow the space we have available for it.
- */
- hlen = ip->ip_hl << 2;
- if (hlen + sizeof(struct tcphdr) > buflen)
- goto bad;
- hlen += ((struct tcphdr *)&((char *)ip)[hlen])->th_off << 2;
- if (hlen > MAX_HDR || hlen > buflen)
- goto bad;
-
+ /*
+ * Calculate the size of the TCP/IP header and make sure that
+ * we don't overflow the space we have available for it.
+ */
+ hlen = ip->ip_hl << 2;
+ if (hlen + sizeof(struct tcphdr) > buflen)
+ goto bad;
+ hlen += ((struct tcphdr *)&((char *)ip)[hlen])->th_off << 2;
+ if (hlen > MAX_HDR || hlen > buflen)
+ goto bad;
BCOPY(ip, &cs->cs_ip, hlen);
cs->cs_hlen = hlen;
INCR(sls_uncompressedin)
diff --git a/sys/net/slcompress.h b/sys/net/slcompress.h
index 9884539b974..c52b485126e 100644
--- a/sys/net/slcompress.h
+++ b/sys/net/slcompress.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: slcompress.h,v 1.2 1997/02/24 13:34:04 niklas Exp $ */
-/* $NetBSD: slcompress.h,v 1.9 1995/07/04 06:28:29 paulus Exp $ */
+/* $OpenBSD: slcompress.h,v 1.3 1997/09/05 04:27:05 millert Exp $ */
+/* $NetBSD: slcompress.h,v 1.11 1997/05/17 21:12:11 christos 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_ */