/*
* This version is for use with mbufs on Ultrix systems.
*
- * $Id: bsd-comp.c,v 1.4 1995/05/01 01:41:29 paulus Exp $
+ * $Id: bsd-comp.c,v 1.8 1996/08/28 06:32:00 paulus Exp $
*/
#include "../h/param.h"
};
#define BSD_OVHD 2 /* BSD compress overhead/packet */
-#define BSD_INIT_BITS MIN_BSD_BITS
+#define BSD_INIT_BITS BSD_MIN_BITS
static void *bsd_comp_alloc __P((u_char *options, int opt_len));
static void *bsd_decomp_alloc __P((u_char *options, int opt_len));
#define RATIO_SCALE (1<<RATIO_SCALE_LOG)
#define RATIO_MAX (0x7fffffff>>RATIO_SCALE_LOG)
+static void bsd_clear __P((struct bsd_db *));
+static int bsd_check __P((struct bsd_db *));
+static void *bsd_alloc __P((u_char *, int, int));
+static int bsd_init __P((struct bsd_db *, u_char *, int, int, int, int,
+ int, int));
+
/*
* clear the dictionary
*/
db->ratio = 0;
db->bytes_out = 0;
db->in_count = 0;
- db->incomp_count = 0;
db->checkpoint = CHECK_GAP;
}
u_int newlen, hsize, hshift, maxmaxcode;
struct bsd_db *db;
- if (opt_len != CILEN_BSD_COMPRESS || options[0] != CI_BSD_COMPRESS
+ if (opt_len < CILEN_BSD_COMPRESS || options[0] != CI_BSD_COMPRESS
|| options[1] != CILEN_BSD_COMPRESS
|| BSD_VERSION(options[2]) != BSD_CURRENT_VERSION)
return NULL;
{
int i;
- if (opt_len != CILEN_BSD_COMPRESS || options[0] != CI_BSD_COMPRESS
+ if (opt_len < CILEN_BSD_COMPRESS || options[0] != CI_BSD_COMPRESS
|| options[1] != CILEN_BSD_COMPRESS
|| BSD_VERSION(options[2]) != BSD_CURRENT_VERSION
|| BSD_NBITS(options[2]) != db->maxbits
u_char *rptr, *wptr;
u_char *cp_end;
int olen;
- struct mbuf *m, **mnp, *clp;
+ struct mbuf *m, *clp;
#define PUTBYTE(v) { \
++olen; \
if (ent < 0x21 || ent > 0xf9)
return;
- db->incomp_count++;
db->seqno++;
ilen = 1; /* count the protocol as 1 byte */
rptr += PPP_HDRLEN;
struct mbuf *m, *dmp, *mret;
int adrs, ctrl, ilen;
int space, codelen, extra;
- struct mbuf *last, *clp;
+ struct mbuf *clp;
/*
* Save the address/control from the PPP header