diff options
author | brian <brian@FreeBSD.org> | 1999-05-08 11:07:56 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1999-05-08 11:07:56 +0000 |
commit | ab7d88ae2d8ea955c6193cc242b9cee4d58f8fd4 (patch) | |
tree | e79816f983bd5a5be86a78fe0aafbd00a13ac2db /usr.sbin/ppp/deflate.c | |
parent | 713dd62834d401cc7b9b394a4b916ab9e5e3d4d5 (diff) | |
download | FreeBSD-src-ab7d88ae2d8ea955c6193cc242b9cee4d58f8fd4.zip FreeBSD-src-ab7d88ae2d8ea955c6193cc242b9cee4d58f8fd4.tar.gz |
o Redesign the layering mechanism and make the aliasing code part of
the layering.
We now ``stack'' layers as soon as we open the device (when we figure
out what we're dealing with). A static set of `dispatch' routines are
also declared for dealing with incoming packets after they've been
`pulled' up through the stacked layers.
Physical devices are now assigned handlers based on the device type
when they're opened. For the moment there are three device types;
ttys, execs and tcps.
o Increment version number to 2.2
o Make an entry in [uw]tmp for non-tty -direct invocations (after
pap/chap authentication).
o Make throughput counters quad_t's
o Account for the absolute number of mbuf malloc()s and free()s in
``show mem''.
o ``show modem'' becomes ``show physical''.
Diffstat (limited to 'usr.sbin/ppp/deflate.c')
-rw-r--r-- | usr.sbin/ppp/deflate.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/usr.sbin/ppp/deflate.c b/usr.sbin/ppp/deflate.c index d19d93c..261d3e2 100644 --- a/usr.sbin/ppp/deflate.c +++ b/usr.sbin/ppp/deflate.c @@ -23,13 +23,14 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: deflate.c,v 1.11 1998/08/07 18:42:48 brian Exp $ + * $Id: deflate.c,v 1.12 1999/03/11 01:49:15 brian Exp $ */ #include <sys/types.h> #include <stdio.h> #include <stdlib.h> +#include <termios.h> #include <zlib.h> #include "defs.h" @@ -54,7 +55,7 @@ struct deflate_state { static char garbage[10]; static u_char EMPTY_BLOCK[4] = { 0x00, 0x00, 0xff, 0xff }; -#define DEFLATE_CHUNK_LEN 1024 /* Allocate mbufs this size */ +#define DEFLATE_CHUNK_LEN 1600 /* Allocate mbufs this size */ static void DeflateResetOutput(void *v) @@ -67,8 +68,8 @@ DeflateResetOutput(void *v) log_Printf(LogCCP, "Deflate: Output channel reset\n"); } -static int -DeflateOutput(void *v, struct ccp *ccp, struct link *l, int pri, u_short proto, +static struct mbuf * +DeflateOutput(void *v, struct ccp *ccp, struct link *l, int pri, u_short *proto, struct mbuf *mp) { struct deflate_state *state = (struct deflate_state *)v; @@ -77,19 +78,19 @@ DeflateOutput(void *v, struct ccp *ccp, struct link *l, int pri, u_short proto, struct mbuf *mo_head, *mo, *mi_head, *mi; ilen = mbuf_Length(mp); - log_Printf(LogDEBUG, "DeflateOutput: Proto %02x (%d bytes)\n", proto, ilen); + log_Printf(LogDEBUG, "DeflateOutput: Proto %02x (%d bytes)\n", *proto, ilen); log_DumpBp(LogDEBUG, "DeflateOutput: Compress packet:", mp); /* Stuff the protocol in front of the input */ mi_head = mi = mbuf_Alloc(2, MB_HDLCOUT); mi->next = mp; rp = MBUF_CTOP(mi); - if (proto < 0x100) { /* Compress the protocol */ - rp[0] = proto & 0377; + if (*proto < 0x100) { /* Compress the protocol */ + rp[0] = *proto & 0377; mi->cnt = 1; } else { /* Don't compress the protocol */ - rp[0] = proto >> 8; - rp[1] = proto & 0377; + rp[0] = *proto >> 8; + rp[1] = *proto & 0377; mi->cnt = 2; } @@ -119,7 +120,7 @@ DeflateOutput(void *v, struct ccp *ccp, struct link *l, int pri, u_short proto, mbuf_Free(mo_head); mbuf_FreeSeg(mi_head); state->seqno--; - return 1; /* packet dropped */ + return mp; /* Our dictionary's probably dead now :-( */ } if (flush == Z_SYNC_FLUSH && state->cx.avail_out != 0) @@ -154,10 +155,10 @@ DeflateOutput(void *v, struct ccp *ccp, struct link *l, int pri, u_short proto, mbuf_Free(mo_head); mbuf_FreeSeg(mi_head); log_Printf(LogDEBUG, "DeflateOutput: %d => %d: Uncompressible (0x%04x)\n", - ilen, olen, proto); + ilen, olen, *proto); ccp->uncompout += ilen; ccp->compout += ilen; /* We measure this stuff too */ - return 0; + return mp; } mbuf_Free(mi_head); @@ -179,10 +180,10 @@ DeflateOutput(void *v, struct ccp *ccp, struct link *l, int pri, u_short proto, ccp->compout += olen; log_Printf(LogDEBUG, "DeflateOutput: %d => %d bytes, proto 0x%04x\n", - ilen, olen, proto); + ilen, olen, *proto); - hdlc_Output(l, PRI_NORMAL, ccp_Proto(ccp), mo_head); - return 1; + *proto = ccp_Proto(ccp); + return mo_head; } static void |