1 |
786 |
skrzyp |
//==========================================================================
|
2 |
|
|
//
|
3 |
|
|
// include/net/ppp_defs.h
|
4 |
|
|
//
|
5 |
|
|
//==========================================================================
|
6 |
|
|
// ####ECOSGPLCOPYRIGHTBEGIN####
|
7 |
|
|
// -------------------------------------------
|
8 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
9 |
|
|
// Copyright (C) 2003 Free Software Foundation, Inc.
|
10 |
|
|
//
|
11 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
12 |
|
|
// the terms of the GNU General Public License as published by the Free
|
13 |
|
|
// Software Foundation; either version 2 or (at your option) any later
|
14 |
|
|
// version.
|
15 |
|
|
//
|
16 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
17 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
18 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
19 |
|
|
// for more details.
|
20 |
|
|
//
|
21 |
|
|
// You should have received a copy of the GNU General Public License
|
22 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
23 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
24 |
|
|
//
|
25 |
|
|
// As a special exception, if other files instantiate templates or use
|
26 |
|
|
// macros or inline functions from this file, or you compile this file
|
27 |
|
|
// and link it with other works to produce a work based on this file,
|
28 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
29 |
|
|
// the GNU General Public License. However the source code for this file
|
30 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
31 |
|
|
// General Public License v2.
|
32 |
|
|
//
|
33 |
|
|
// This exception does not invalidate any other reasons why a work based
|
34 |
|
|
// on this file might be covered by the GNU General Public License.
|
35 |
|
|
// -------------------------------------------
|
36 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
37 |
|
|
// ####BSDALTCOPYRIGHTBEGIN####
|
38 |
|
|
// -------------------------------------------
|
39 |
|
|
// Portions of this software may have been derived from FreeBSD, OpenBSD,
|
40 |
|
|
// or other sources, and if so are covered by the appropriate copyright
|
41 |
|
|
// and license included herein.
|
42 |
|
|
// -------------------------------------------
|
43 |
|
|
// ####BSDALTCOPYRIGHTEND####
|
44 |
|
|
//==========================================================================
|
45 |
|
|
|
46 |
|
|
/*
|
47 |
|
|
* ppp_defs.h - PPP definitions.
|
48 |
|
|
*
|
49 |
|
|
* Copyright (c) 1994 The Australian National University.
|
50 |
|
|
* All rights reserved.
|
51 |
|
|
*
|
52 |
|
|
* Permission to use, copy, modify, and distribute this software and its
|
53 |
|
|
* documentation is hereby granted, provided that the above copyright
|
54 |
|
|
* notice appears in all copies. This software is provided without any
|
55 |
|
|
* warranty, express or implied. The Australian National University
|
56 |
|
|
* makes no representations about the suitability of this software for
|
57 |
|
|
* any purpose.
|
58 |
|
|
*
|
59 |
|
|
* IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
|
60 |
|
|
* PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
61 |
|
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
|
62 |
|
|
* THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
|
63 |
|
|
* OF SUCH DAMAGE.
|
64 |
|
|
*
|
65 |
|
|
* THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
66 |
|
|
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
67 |
|
|
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
68 |
|
|
* ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
|
69 |
|
|
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
|
70 |
|
|
* OR MODIFICATIONS.
|
71 |
|
|
*
|
72 |
|
|
* $FreeBSD: src/sys/net/ppp_defs.h,v 1.6.2.1 2001/07/03 11:01:41 ume Exp $
|
73 |
|
|
*/
|
74 |
|
|
|
75 |
|
|
#ifndef _PPP_DEFS_H_
|
76 |
|
|
#define _PPP_DEFS_H_
|
77 |
|
|
|
78 |
|
|
/*
|
79 |
|
|
* The basic PPP frame.
|
80 |
|
|
*/
|
81 |
|
|
#define PPP_HDRLEN 4 /* octets for standard ppp header */
|
82 |
|
|
#define PPP_FCSLEN 2 /* octets for FCS */
|
83 |
|
|
#define PPP_MRU 1500 /* default MRU = max length of info field */
|
84 |
|
|
|
85 |
|
|
#define PPP_ADDRESS(p) (((u_char *)(p))[0])
|
86 |
|
|
#define PPP_CONTROL(p) (((u_char *)(p))[1])
|
87 |
|
|
#define PPP_PROTOCOL(p) ((((u_char *)(p))[2] << 8) + ((u_char *)(p))[3])
|
88 |
|
|
|
89 |
|
|
/*
|
90 |
|
|
* Significant octet values.
|
91 |
|
|
*/
|
92 |
|
|
#define PPP_ALLSTATIONS 0xff /* All-Stations broadcast address */
|
93 |
|
|
#define PPP_UI 0x03 /* Unnumbered Information */
|
94 |
|
|
#define PPP_FLAG 0x7e /* Flag Sequence */
|
95 |
|
|
#define PPP_ESCAPE 0x7d /* Asynchronous Control Escape */
|
96 |
|
|
#define PPP_TRANS 0x20 /* Asynchronous transparency modifier */
|
97 |
|
|
|
98 |
|
|
/*
|
99 |
|
|
* Protocol field values.
|
100 |
|
|
*/
|
101 |
|
|
#define PPP_IP 0x21 /* Internet Protocol */
|
102 |
|
|
#define PPP_XNS 0x25 /* Xerox NS */
|
103 |
|
|
#define PPP_AT 0x29 /* AppleTalk Protocol */
|
104 |
|
|
#define PPP_IPX 0x2b /* IPX Datagram (RFC1552) */
|
105 |
|
|
#define PPP_VJC_COMP 0x2d /* VJ compressed TCP */
|
106 |
|
|
#define PPP_VJC_UNCOMP 0x2f /* VJ uncompressed TCP */
|
107 |
|
|
#define PPP_COMP 0xfd /* compressed packet */
|
108 |
|
|
#define PPP_IPCP 0x8021 /* IP Control Protocol */
|
109 |
|
|
#define PPP_ATCP 0x8029 /* AppleTalk Control Protocol */
|
110 |
|
|
#define PPP_IPXCP 0x802b /* IPX Control Protocol (RFC1552) */
|
111 |
|
|
#define PPP_CCP 0x80fd /* Compression Control Protocol */
|
112 |
|
|
#define PPP_LCP 0xc021 /* Link Control Protocol */
|
113 |
|
|
#define PPP_PAP 0xc023 /* Password Authentication Protocol */
|
114 |
|
|
#define PPP_LQR 0xc025 /* Link Quality Report protocol */
|
115 |
|
|
#define PPP_CHAP 0xc223 /* Cryptographic Handshake Auth. Protocol */
|
116 |
|
|
#define PPP_CBCP 0xc029 /* Callback Control Protocol */
|
117 |
|
|
#define PPP_IPV6 0x57 /* Internet Protocol version 6*/
|
118 |
|
|
#define PPP_IPV6CP 0x8057 /* IPv6 Control Protocol */
|
119 |
|
|
|
120 |
|
|
/*
|
121 |
|
|
* Values for FCS calculations.
|
122 |
|
|
*/
|
123 |
|
|
#define PPP_INITFCS 0xffff /* Initial FCS value */
|
124 |
|
|
#define PPP_GOODFCS 0xf0b8 /* Good final FCS value */
|
125 |
|
|
#define PPP_FCS(fcs, c) (((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff])
|
126 |
|
|
|
127 |
|
|
/*
|
128 |
|
|
* Extended asyncmap - allows any character to be escaped.
|
129 |
|
|
*/
|
130 |
|
|
typedef u_int32_t ext_accm[8];
|
131 |
|
|
|
132 |
|
|
/*
|
133 |
|
|
* What to do with network protocol (NP) packets.
|
134 |
|
|
*/
|
135 |
|
|
enum NPmode {
|
136 |
|
|
NPMODE_PASS, /* pass the packet through */
|
137 |
|
|
NPMODE_DROP, /* silently drop the packet */
|
138 |
|
|
NPMODE_ERROR, /* return an error */
|
139 |
|
|
NPMODE_QUEUE /* save it up for later. */
|
140 |
|
|
};
|
141 |
|
|
|
142 |
|
|
/*
|
143 |
|
|
* Statistics.
|
144 |
|
|
*/
|
145 |
|
|
struct pppstat {
|
146 |
|
|
unsigned int ppp_ibytes; /* bytes received */
|
147 |
|
|
unsigned int ppp_ipackets; /* packets received */
|
148 |
|
|
unsigned int ppp_ierrors; /* receive errors */
|
149 |
|
|
unsigned int ppp_obytes; /* bytes sent */
|
150 |
|
|
unsigned int ppp_opackets; /* packets sent */
|
151 |
|
|
unsigned int ppp_oerrors; /* transmit errors */
|
152 |
|
|
};
|
153 |
|
|
|
154 |
|
|
struct vjstat {
|
155 |
|
|
unsigned int vjs_packets; /* outbound packets */
|
156 |
|
|
unsigned int vjs_compressed; /* outbound compressed packets */
|
157 |
|
|
unsigned int vjs_searches; /* searches for connection state */
|
158 |
|
|
unsigned int vjs_misses; /* times couldn't find conn. state */
|
159 |
|
|
unsigned int vjs_uncompressedin; /* inbound uncompressed packets */
|
160 |
|
|
unsigned int vjs_compressedin; /* inbound compressed packets */
|
161 |
|
|
unsigned int vjs_errorin; /* inbound unknown type packets */
|
162 |
|
|
unsigned int vjs_tossed; /* inbound packets tossed because of error */
|
163 |
|
|
};
|
164 |
|
|
|
165 |
|
|
struct ppp_stats {
|
166 |
|
|
struct pppstat p; /* basic PPP statistics */
|
167 |
|
|
struct vjstat vj; /* VJ header compression statistics */
|
168 |
|
|
};
|
169 |
|
|
|
170 |
|
|
struct compstat {
|
171 |
|
|
unsigned int unc_bytes; /* total uncompressed bytes */
|
172 |
|
|
unsigned int unc_packets; /* total uncompressed packets */
|
173 |
|
|
unsigned int comp_bytes; /* compressed bytes */
|
174 |
|
|
unsigned int comp_packets; /* compressed packets */
|
175 |
|
|
unsigned int inc_bytes; /* incompressible bytes */
|
176 |
|
|
unsigned int inc_packets; /* incompressible packets */
|
177 |
|
|
unsigned int ratio; /* recent compression ratio << 8 */
|
178 |
|
|
};
|
179 |
|
|
|
180 |
|
|
struct ppp_comp_stats {
|
181 |
|
|
struct compstat c; /* packet compression statistics */
|
182 |
|
|
struct compstat d; /* packet decompression statistics */
|
183 |
|
|
};
|
184 |
|
|
|
185 |
|
|
/*
|
186 |
|
|
* The following structure records the time in seconds since
|
187 |
|
|
* the last NP packet was sent or received.
|
188 |
|
|
*/
|
189 |
|
|
struct ppp_idle {
|
190 |
|
|
time_t xmit_idle; /* time since last NP packet sent */
|
191 |
|
|
time_t recv_idle; /* time since last NP packet received */
|
192 |
|
|
};
|
193 |
|
|
|
194 |
|
|
#ifndef __P
|
195 |
|
|
#ifdef __STDC__
|
196 |
|
|
#define __P(x) x
|
197 |
|
|
#else
|
198 |
|
|
#define __P(x) ()
|
199 |
|
|
#endif
|
200 |
|
|
#endif
|
201 |
|
|
|
202 |
|
|
#endif /* _PPP_DEFS_H_ */
|