2 * Written by Toshiharu OHNO (tony-o@iij.ad.jp)
4 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
6 * Redistribution and use in source and binary forms are permitted
7 * provided that the above copyright notice and this paragraph are
8 * duplicated in all such forms and that any documentation,
9 * advertising materials, and other materials related to such
10 * distribution and use acknowledge that the software was developed
11 * by the Internet Initiative Japan. The name of the
12 * IIJ may not be used to endorse or promote products derived
13 * from this software without specific prior written permission.
14 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
16 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18 * $Id: ccp.h,v 1.20 1999/02/26 21:28:07 brian Exp $
23 #define CCP_MAXCODE CODE_RESETACK
25 #define TY_OUI 0 /* OUI */
26 #define TY_PRED1 1 /* Predictor type 1 */
27 #define TY_PRED2 2 /* Predictor type 2 */
28 #define TY_PUDDLE 3 /* Puddle Jumper */
29 #define TY_HWPPC 16 /* Hewlett-Packard PPC */
30 #define TY_STAC 17 /* Stac Electronics LZS */
31 #define TY_MSPPC 18 /* Microsoft PPC */
32 #define TY_GAND 19 /* Gandalf FZA */
33 #define TY_V42BIS 20 /* V.42bis compression */
34 #define TY_BSD 21 /* BSD LZW Compress */
35 #define TY_PPPD_DEFLATE 24 /* Deflate (gzip) - (mis) numbered by pppd */
36 #define TY_DEFLATE 26 /* Deflate (gzip) - rfc 1979 */
38 #define CCP_NEG_DEFLATE 0
39 #define CCP_NEG_PRED1 1
40 #define CCP_NEG_DEFLATE24 2
41 #define CCP_NEG_TOTAL 3
52 struct fsm_retry fsm; /* How often/frequently to resend requests */
53 unsigned neg[CCP_NEG_TOTAL];
63 struct fsm fsm; /* The finite state machine */
65 int his_proto; /* peer's compression protocol */
66 int my_proto; /* our compression protocol */
68 int reset_sent; /* If != -1, ignore compressed 'till ack */
69 int last_reset; /* We can receive more (dups) w/ this id */
72 int algorithm; /* Algorithm in use */
73 void *state; /* Returned by implementations Init() */
74 struct lcp_opt opt; /* Set by implementations OptInit() */
78 int algorithm; /* Algorithm in use */
79 void *state; /* Returned by implementations Init() */
80 struct ccp_opt *opt; /* Set by implementations OptInit() */
83 u_int32_t his_reject; /* Request codes rejected by peer */
84 u_int32_t my_reject; /* Request codes I have rejected */
86 u_long uncompout, compout; /* Outgoing bytes before/after compression */
87 u_long uncompin, compin; /* Incoming bytes after/before decompression */
89 struct ccp_config cfg;
92 #define fsm2ccp(fp) (fp->proto == PROTO_CCP ? (struct ccp *)fp : NULL)
94 struct ccp_algorithm {
96 int Neg; /* ccp_config neg array item */
97 const char *(*Disp)(struct lcp_opt *); /* Use result immediately ! */
99 int (*Set)(struct lcp_opt *, const struct ccp_config *);
100 void *(*Init)(struct lcp_opt *);
101 void (*Term)(void *);
102 void (*Reset)(void *);
103 struct mbuf *(*Read)(void *, struct ccp *, u_short *, struct mbuf *);
104 void (*DictSetup)(void *, struct ccp *, u_short, struct mbuf *);
107 void (*OptInit)(struct lcp_opt *, const struct ccp_config *);
108 int (*Set)(struct lcp_opt *);
109 void *(*Init)(struct lcp_opt *);
110 void (*Term)(void *);
111 void (*Reset)(void *);
112 struct mbuf *(*Write)(void *, struct ccp *, struct link *, int, u_short *,
117 extern void ccp_Init(struct ccp *, struct bundle *, struct link *,
118 const struct fsm_parent *);
119 extern void ccp_Setup(struct ccp *);
121 extern void ccp_SendResetReq(struct fsm *);
122 extern struct mbuf *ccp_Input(struct bundle *, struct link *, struct mbuf *);
123 extern int ccp_ReportStatus(struct cmdargs const *);
124 extern u_short ccp_Proto(struct ccp *);
125 extern void ccp_SetupCallbacks(struct ccp *);
126 extern int ccp_SetOpenMode(struct ccp *);
128 extern struct layer ccplayer;