]> git.ozlabs.org Git - ppp.git/blob - include/net/ppp-comp.h
added SC_TIMEOUT and PPPIOC[GS]MTU (for ultrix)
[ppp.git] / include / net / ppp-comp.h
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: ppp-comp.h,v 1.5 1994/12/05 00:33:33 paulus Exp $
28  */
29
30 /*
31  * Structure giving methods for compression/decompression.
32  */
33 struct compressor {
34         int     compress_proto; /* CCP compression protocol number */
35
36         /* Allocate space for a compressor (transmit side) */
37         void    *(*comp_alloc) __P((u_char *options, int opt_len));
38         /* Free space used by a compressor */
39         void    (*comp_free) __P((void *state));
40         /* Initialize a compressor */
41         int     (*comp_init) __P((void *state, u_char *options, int opt_len,
42                                   int unit, int debug));
43         /* Reset a compressor */
44         void    (*comp_reset) __P((void *state));
45         /* Compress a packet */
46         int     (*compress) __P((void *state, PACKETPTR *mret,
47                                  PACKETPTR mp, int orig_len, int max_len));
48         /* Return compression statistics */
49         void    (*comp_stat) __P((void *state, struct compstat *stats));
50
51         /* Allocate space for a decompressor (receive side) */
52         void    *(*decomp_alloc) __P((u_char *options, int opt_len));
53         /* Free space used by a decompressor */
54         void    (*decomp_free) __P((void *state));
55         /* Initialize a decompressor */
56         int     (*decomp_init) __P((void *state, u_char *options, int opt_len,
57                                     int unit, int hdrlen, int mru, int debug));
58         /* Reset a decompressor */
59         void    (*decomp_reset) __P((void *state));
60         /* Decompress a packet. */
61         int     (*decompress) __P((void *state, PACKETPTR mp,
62                                    PACKETPTR *dmpp));
63         /* Update state for an incompressible packet received */
64         void    (*incomp) __P((void *state, PACKETPTR mp));
65         /* Return decompression statistics */
66         void    (*decomp_stat) __P((void *state, struct compstat *stats));
67 };
68
69 /*
70  * Return values for decompress routine.
71  * We need to make these distinctions so that we can disable certain
72  * useful functionality, namely sending a CCP reset-request as a result
73  * of an error detected after decompression.  This is to avoid infringing
74  * a patent held by Motorola.
75  * Don't you just lurve software patents.
76  */
77 #define DECOMP_OK               0       /* everything went OK */
78 #define DECOMP_ERROR            1       /* error detected before decomp. */
79 #define DECOMP_FATALERROR       2       /* error detected after decomp. */
80
81 /*
82  * CCP codes.
83  */
84 #define CCP_CONFREQ     1
85 #define CCP_CONFACK     2
86 #define CCP_TERMREQ     5
87 #define CCP_TERMACK     6
88 #define CCP_RESETREQ    14
89 #define CCP_RESETACK    15
90
91 /*
92  * Max # bytes for a CCP option
93  */
94 #define CCP_MAX_OPTION_LENGTH   32
95
96 /*
97  * Parts of a CCP packet.
98  */
99 #define CCP_CODE(dp)            ((dp)[0])
100 #define CCP_ID(dp)              ((dp)[1])
101 #define CCP_LENGTH(dp)          (((dp)[2] << 8) + (dp)[3])
102 #define CCP_HDRLEN              4
103
104 #define CCP_OPT_CODE(dp)        ((dp)[0])
105 #define CCP_OPT_LENGTH(dp)      ((dp)[1])
106 #define CCP_OPT_MINLEN          2
107