source: rtems/c/src/exec/libnetworking/net/ppp-comp.h @ 0286b9f

4.104.114.84.95
Last change on this file since 0286b9f was 0286b9f, checked in by Joel Sherrill <joel.sherrill@…>, on 01/31/02 at 21:42:11

2001-01-31 Mike Siers <mikes@…>

  • Nice Update of PPPD support which eliminates the requiremetn that drivers be in the termios TASK_DRIVEN mode. Mike did significant testing and reports that it seems to be more stable and handle larger packets better. This patch replaces the termios tasks with more general pppd network driver tasks. The functions pppinput() and pppstart() get called from the interrupt service routine.
  • Makefile.am, configure.ac, net/Makefile.am, net/bpf.h, net/ethernet.h, net/if.c, net/if.h, net/if_arp.h, net/if_dl.h, net/if_ethersubr.c, net/if_llc.h, net/if_loop.c, net/if_ppp.h, net/if_pppvar.h, net/if_types.h, net/netisr.h, net/ppp-comp.h, net/ppp_defs.h, net/pppcompress.h, net/radix.c, net/radix.h, net/raw_cb.c, net/raw_cb.h, net/raw_usrreq.c, net/route.c, net/route.h, net/rtsock.c, pppd/Makefile.am, pppd/README, pppd/STATUS, pppd/auth.c, pppd/cbcp.c, pppd/ccp.c, pppd/ccp.h, pppd/chap.c, pppd/chap.h, pppd/chap_ms.c, pppd/chap_ms.h, pppd/chat.c, pppd/demand.c, pppd/fsm.c, pppd/fsm.h, pppd/ipcp.c, pppd/ipcp.h, pppd/ipxcp.c, pppd/ipxcp.h, pppd/lcp.c, pppd/lcp.h, pppd/magic.c, pppd/magic.h, pppd/options.c, pppd/patchlevel.h, pppd/pathnames.h, pppd/pppd.8, pppd/pppd.h, pppd/rtemsmain.c, pppd/rtemspppd.c, pppd/rtemspppd.h, pppd/sys-rtems.c, pppd/upap.c, pppd/upap.h, pppd/utils.c, pppd/example/README, pppd/example/netconfig.h, wrapup/Makefile.am: Modified.
  • net/bsd-comp.c, net/if_ppp.c, net/ppp-deflate.c, net/ppp.h, net/ppp_tty.c, net/pppcompress.c, net/zlib.c, net/zlib.h: New file.
  • modem/, modem/.cvsignore, modem/Makefile.am, modem/ppp.c, modem/ppp.h, modem/ppp_tty.c, modem/pppcompress.c: Subdirectory removed.
  • Property mode set to 100644
File size: 5.5 KB
Line 
1/*
2 * ppp-comp.h - Definitions for doing PPP packet compression.
3 *
4 * Copyright (c) 1994 The Australian National University.
5 * All rights reserved.
6 *
7 * Permission to use, copy, modify, and distribute this software and its
8 * documentation is hereby granted, provided that the above copyright
9 * notice appears in all copies.  This software is provided without any
10 * warranty, express or implied. The Australian National University
11 * makes no representations about the suitability of this software for
12 * any purpose.
13 *
14 * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
15 * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
16 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
17 * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
18 * OF SUCH DAMAGE.
19 *
20 * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
21 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
23 * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
24 * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
25 * OR MODIFICATIONS.
26 *
27 * $Id$
28 */
29
30#ifndef _NET_PPP_COMP_H
31#define _NET_PPP_COMP_H
32
33/*
34 * The following symbols control whether we include code for
35 * various compression methods.
36 */
37#ifndef DO_BSD_COMPRESS
38#define DO_BSD_COMPRESS 0       /* by default, include BSD-Compress */
39#endif
40#ifndef DO_DEFLATE
41#define DO_DEFLATE      0       /* by default, include Deflate */
42#endif
43#define DO_PREDICTOR_1  0
44#define DO_PREDICTOR_2  0
45
46/*
47 * Structure giving methods for compression/decompression.
48 */
49#ifdef PACKETPTR
50struct compressor {
51        int     compress_proto; /* CCP compression protocol number */
52
53        /* Allocate space for a compressor (transmit side) */
54        void    *(*comp_alloc) __P((u_char *options, int opt_len));
55        /* Free space used by a compressor */
56        void    (*comp_free) __P((void *state));
57        /* Initialize a compressor */
58        int     (*comp_init) __P((void *state, u_char *options, int opt_len,
59                                  int unit, int hdrlen, int debug));
60        /* Reset a compressor */
61        void    (*comp_reset) __P((void *state));
62        /* Compress a packet */
63        int     (*compress) __P((void *state, PACKETPTR *mret,
64                                 PACKETPTR mp, int orig_len, int max_len));
65        /* Return compression statistics */
66        void    (*comp_stat) __P((void *state, struct compstat *stats));
67
68        /* Allocate space for a decompressor (receive side) */
69        void    *(*decomp_alloc) __P((u_char *options, int opt_len));
70        /* Free space used by a decompressor */
71        void    (*decomp_free) __P((void *state));
72        /* Initialize a decompressor */
73        int     (*decomp_init) __P((void *state, u_char *options, int opt_len,
74                                    int unit, int hdrlen, int mru, int debug));
75        /* Reset a decompressor */
76        void    (*decomp_reset) __P((void *state));
77        /* Decompress a packet. */
78        int     (*decompress) __P((void *state, PACKETPTR mp,
79                                   PACKETPTR *dmpp));
80        /* Update state for an incompressible packet received */
81        void    (*incomp) __P((void *state, PACKETPTR mp));
82        /* Return decompression statistics */
83        void    (*decomp_stat) __P((void *state, struct compstat *stats));
84};
85#endif /* PACKETPTR */
86
87/*
88 * Return values for decompress routine.
89 * We need to make these distinctions so that we can disable certain
90 * useful functionality, namely sending a CCP reset-request as a result
91 * of an error detected after decompression.  This is to avoid infringing
92 * a patent held by Motorola.
93 * Don't you just lurve software patents.
94 */
95#define DECOMP_OK               0       /* everything went OK */
96#define DECOMP_ERROR            1       /* error detected before decomp. */
97#define DECOMP_FATALERROR       2       /* error detected after decomp. */
98
99/*
100 * CCP codes.
101 */
102#define CCP_CONFREQ     1
103#define CCP_CONFACK     2
104#define CCP_TERMREQ     5
105#define CCP_TERMACK     6
106#define CCP_RESETREQ    14
107#define CCP_RESETACK    15
108
109/*
110 * Max # bytes for a CCP option
111 */
112#define CCP_MAX_OPTION_LENGTH   32
113
114/*
115 * Parts of a CCP packet.
116 */
117#define CCP_CODE(dp)            ((dp)[0])
118#define CCP_ID(dp)              ((dp)[1])
119#define CCP_LENGTH(dp)          (((dp)[2] << 8) + (dp)[3])
120#define CCP_HDRLEN              4
121
122#define CCP_OPT_CODE(dp)        ((dp)[0])
123#define CCP_OPT_LENGTH(dp)      ((dp)[1])
124#define CCP_OPT_MINLEN          2
125
126/*
127 * Definitions for BSD-Compress.
128 */
129#define CI_BSD_COMPRESS         21      /* config. option for BSD-Compress */
130#define CILEN_BSD_COMPRESS      3       /* length of config. option */
131
132/* Macros for handling the 3rd byte of the BSD-Compress config option. */
133#define BSD_NBITS(x)            ((x) & 0x1F)    /* number of bits requested */
134#define BSD_VERSION(x)          ((x) >> 5)      /* version of option format */
135#define BSD_CURRENT_VERSION     1               /* current version number */
136#define BSD_MAKE_OPT(v, n)      (((v) << 5) | (n))
137
138#define BSD_MIN_BITS            9       /* smallest code size supported */
139#define BSD_MAX_BITS            15      /* largest code size supported */
140
141/*
142 * Definitions for Deflate.
143 */
144#define CI_DEFLATE              26      /* config option for Deflate */
145#define CI_DEFLATE_DRAFT        24      /* value used in original draft RFC */
146#define CILEN_DEFLATE           4       /* length of its config option */
147
148#define DEFLATE_MIN_SIZE        8
149#define DEFLATE_MAX_SIZE        15
150#define DEFLATE_METHOD_VAL      8
151#define DEFLATE_SIZE(x)         (((x) >> 4) + DEFLATE_MIN_SIZE)
152#define DEFLATE_METHOD(x)       ((x) & 0x0F)
153#define DEFLATE_MAKE_OPT(w)     ((((w) - DEFLATE_MIN_SIZE) << 4) \
154                                 + DEFLATE_METHOD_VAL)
155#define DEFLATE_CHK_SEQUENCE    0
156
157/*
158 * Definitions for other, as yet unsupported, compression methods.
159 */
160#define CI_PREDICTOR_1          1       /* config option for Predictor-1 */
161#define CILEN_PREDICTOR_1       2       /* length of its config option */
162#define CI_PREDICTOR_2          2       /* config option for Predictor-2 */
163#define CILEN_PREDICTOR_2       2       /* length of its config option */
164
165#endif /* _NET_PPP_COMP_H */
Note: See TracBrowser for help on using the repository browser.