]> git.ozlabs.org Git - ppp.git/blob - include/linux/ppp_defs.h
Get the repository a bit closer to what will be released
[ppp.git] / include / linux / ppp_defs.h
1 /*      $Id: ppp_defs.h,v 1.11 2002/12/06 09:49:15 paulus Exp $ */
2
3 /*
4  * ppp_defs.h - PPP definitions.
5  *
6  * Copyright (c) 1989-2002 Paul Mackerras. All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in
17  *    the documentation and/or other materials provided with the
18  *    distribution.
19  *
20  * 3. The name(s) of the authors of this software must not be used to
21  *    endorse or promote products derived from this software without
22  *    prior written permission.
23  *
24  * 4. Redistributions of any form whatsoever must retain the following
25  *    acknowledgment:
26  *    "This product includes software developed by Paul Mackerras
27  *     <paulus@samba.org>".
28  *
29  * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO
30  * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
31  * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
32  * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
33  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
34  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
35  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
36  */
37
38 /*
39  *  ==FILEVERSION 20020521==
40  *
41  *  NOTE TO MAINTAINERS:
42  *     If you modify this file at all, please set the above date.
43  *     ppp_defs.h is shipped with a PPP distribution as well as with the kernel;
44  *     if everyone increases the FILEVERSION number above, then scripts
45  *     can do the right thing when deciding whether to install a new ppp_defs.h
46  *     file.  Don't change the format of that line otherwise, so the
47  *     installation script can recognize it.
48  */
49
50 #ifndef _PPP_DEFS_H_
51 #define _PPP_DEFS_H_
52
53 /*
54  * The basic PPP frame.
55  */
56 #define PPP_HDRLEN      4       /* octets for standard ppp header */
57 #define PPP_FCSLEN      2       /* octets for FCS */
58 #define PPP_MRU         1500    /* default MRU = max length of info field */
59
60 #define PPP_ADDRESS(p)  (((__u8 *)(p))[0])
61 #define PPP_CONTROL(p)  (((__u8 *)(p))[1])
62 #define PPP_PROTOCOL(p) ((((__u8 *)(p))[2] << 8) + ((__u8 *)(p))[3])
63
64 /*
65  * Significant octet values.
66  */
67 #define PPP_ALLSTATIONS 0xff    /* All-Stations broadcast address */
68 #define PPP_UI          0x03    /* Unnumbered Information */
69 #define PPP_FLAG        0x7e    /* Flag Sequence */
70 #define PPP_ESCAPE      0x7d    /* Asynchronous Control Escape */
71 #define PPP_TRANS       0x20    /* Asynchronous transparency modifier */
72
73 /*
74  * Protocol field values.
75  */
76 #define PPP_IP          0x21    /* Internet Protocol */
77 #define PPP_AT          0x29    /* AppleTalk Protocol */
78 #define PPP_IPX         0x2b    /* IPX protocol */
79 #define PPP_VJC_COMP    0x2d    /* VJ compressed TCP */
80 #define PPP_VJC_UNCOMP  0x2f    /* VJ uncompressed TCP */
81 #define PPP_MP          0x3d    /* Multilink protocol */
82 #define PPP_IPV6        0x57    /* Internet Protocol Version 6 */
83 #define PPP_COMPFRAG    0xfb    /* fragment compressed below bundle */
84 #define PPP_COMP        0xfd    /* compressed packet */
85 #define PPP_IPCP        0x8021  /* IP Control Protocol */
86 #define PPP_ATCP        0x8029  /* AppleTalk Control Protocol */
87 #define PPP_IPXCP       0x802b  /* IPX Control Protocol */
88 #define PPP_IPV6CP      0x8057  /* IPv6 Control Protocol */
89 #define PPP_CCPFRAG     0x80fb  /* CCP at link level (below MP bundle) */
90 #define PPP_CCP         0x80fd  /* Compression Control Protocol */
91 #define PPP_ECPFRAG     0x8055  /* ECP at link level (below MP bundle) */
92 #define PPP_ECP         0x8053  /* Encryption Control Protocol */
93 #define PPP_LCP         0xc021  /* Link Control Protocol */
94 #define PPP_PAP         0xc023  /* Password Authentication Protocol */
95 #define PPP_LQR         0xc025  /* Link Quality Report protocol */
96 #define PPP_CHAP        0xc223  /* Cryptographic Handshake Auth. Protocol */
97 #define PPP_CBCP        0xc029  /* Callback Control Protocol */
98
99 /*
100  * Values for FCS calculations.
101  */
102
103 #define PPP_INITFCS     0xffff  /* Initial FCS value */
104 #define PPP_GOODFCS     0xf0b8  /* Good final FCS value */
105 #define PPP_FCS(fcs, c) (((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff])
106
107 /*
108  * Extended asyncmap - allows any character to be escaped.
109  */
110
111 typedef __u32           ext_accm[8];
112
113 /*
114  * What to do with network protocol (NP) packets.
115  */
116 enum NPmode {
117     NPMODE_PASS,                /* pass the packet through */
118     NPMODE_DROP,                /* silently drop the packet */
119     NPMODE_ERROR,               /* return an error */
120     NPMODE_QUEUE                /* save it up for later. */
121 };
122
123 /*
124  * Statistics for LQRP and pppstats
125  */
126 struct pppstat  {
127     __u32       ppp_discards;   /* # frames discarded */
128
129     __u32       ppp_ibytes;     /* bytes received */
130     __u32       ppp_ioctects;   /* bytes received not in error */
131     __u32       ppp_ipackets;   /* packets received */
132     __u32       ppp_ierrors;    /* receive errors */
133     __u32       ppp_ilqrs;      /* # LQR frames received */
134
135     __u32       ppp_obytes;     /* raw bytes sent */
136     __u32       ppp_ooctects;   /* frame bytes sent */
137     __u32       ppp_opackets;   /* packets sent */
138     __u32       ppp_oerrors;    /* transmit errors */ 
139     __u32       ppp_olqrs;      /* # LQR frames sent */
140 };
141
142 struct vjstat {
143     __u32       vjs_packets;    /* outbound packets */
144     __u32       vjs_compressed; /* outbound compressed packets */
145     __u32       vjs_searches;   /* searches for connection state */
146     __u32       vjs_misses;     /* times couldn't find conn. state */
147     __u32       vjs_uncompressedin; /* inbound uncompressed packets */
148     __u32       vjs_compressedin;   /* inbound compressed packets */
149     __u32       vjs_errorin;    /* inbound unknown type packets */
150     __u32       vjs_tossed;     /* inbound packets tossed because of error */
151 };
152
153 struct compstat {
154     __u32       unc_bytes;      /* total uncompressed bytes */
155     __u32       unc_packets;    /* total uncompressed packets */
156     __u32       comp_bytes;     /* compressed bytes */
157     __u32       comp_packets;   /* compressed packets */
158     __u32       inc_bytes;      /* incompressible bytes */
159     __u32       inc_packets;    /* incompressible packets */
160
161     /* the compression ratio is defined as in_count / bytes_out */
162     __u32       in_count;       /* Bytes received */
163     __u32       bytes_out;      /* Bytes transmitted */
164
165     double      ratio;          /* not computed in kernel. */
166 };
167
168 struct ppp_stats {
169     struct pppstat      p;      /* basic PPP statistics */
170     struct vjstat       vj;     /* VJ header compression statistics */
171 };
172
173 struct ppp_comp_stats {
174     struct compstat     c;      /* packet compression statistics */
175     struct compstat     d;      /* packet decompression statistics */
176 };
177
178 /*
179  * The following structure records the time in seconds since
180  * the last NP packet was sent or received.
181  */
182 struct ppp_idle {
183     time_t xmit_idle;           /* time since last NP packet sent */
184     time_t recv_idle;           /* time since last NP packet received */
185 };
186
187 #ifndef __P
188 #ifdef __STDC__
189 #define __P(x)  x
190 #else
191 #define __P(x)  ()
192 #endif
193 #endif
194
195 #endif /* _PPP_DEFS_H_ */