Subversion Repositories SvarDOS

Rev

Rev 616 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
207 mateuszvis 1
/*!\file net/ppp_defs.h
2
 * PPP definitions.
3
 */
4
 
5
/*      $Id: ppp_defs.h,v 1.11 1997/04/30 05:46:24 paulus Exp $ */
6
 
7
/*
8
 * ppp_defs.h - PPP definitions.
9
 *
10
 * Copyright (c) 1994 The Australian National University.
11
 * All rights reserved.
12
 *
13
 * Permission to use, copy, modify, and distribute this software and its
14
 * documentation is hereby granted, provided that the above copyright
15
 * notice appears in all copies.  This software is provided without any
16
 * warranty, express or implied. The Australian National University
17
 * makes no representations about the suitability of this software for
18
 * any purpose.
19
 *
20
 * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
21
 * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
22
 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
23
 * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
24
 * OF SUCH DAMAGE.
25
 *
26
 * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
27
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
28
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
29
 * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
30
 * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
31
 * OR MODIFICATIONS.
32
 */
33
 
34
#ifndef __NET_PPP_DEFS_H
35
#define __NET_PPP_DEFS_H
36
 
37
/*
38
 * The basic PPP frame.
39
 */
40
#define PPP_HDRLEN	4	/* octets for standard ppp header */
41
#define PPP_FCSLEN	2	/* octets for FCS */
42
 
43
/*
44
 * Packet sizes
45
 *
46
 * Note - lcp shouldn't be allowed to negotiate stuff outside these
47
 *	  limits.  See lcp.h in the pppd directory.
48
 * (XXX - these constants should simply be shared by lcp.c instead
49
 *	  of living in lcp.h)
50
 */
51
#define	PPP_MTU		1500	/* Default MTU (size of Info field) */
52
#define PPP_MAXMTU	65535 - (PPP_HDRLEN + PPP_FCSLEN)
53
#define PPP_MINMTU	64
54
#define PPP_MRU		1500	/* default MRU = max length of info field */
55
#define PPP_MAXMRU	65000	/* Largest MRU we allow */
56
#define PPP_MINMRU	128
57
 
58
#define PPP_ADDRESS(p)	(((u_char *)(p))[0])
59
#define PPP_CONTROL(p)	(((u_char *)(p))[1])
60
#define PPP_PROTOCOL(p)	((((u_char *)(p))[2] << 8) + ((u_char *)(p))[3])
61
 
62
/*
63
 * Significant octet values.
64
 */
65
#define	PPP_ALLSTATIONS	0xff	/* All-Stations broadcast address */
66
#define	PPP_UI		0x03	/* Unnumbered Information */
67
#define	PPP_FLAG	0x7e	/* Flag Sequence */
68
#define	PPP_ESCAPE	0x7d	/* Asynchronous Control Escape */
69
#define	PPP_TRANS	0x20	/* Asynchronous transparency modifier */
70
 
71
/*
72
 * Protocol field values.
73
 */
74
#define PPP_IP          0x0021  /* Raw IP */
75
#define PPP_OSI         0x0023  /* OSI Network Layer */
76
#define PPP_NS          0x0025  /* Xerox NS IDP */
77
#define PPP_DECNET      0x0027  /* DECnet Phase IV */
78
#define PPP_APPLE       0x0029  /* Appletalk */
79
#define PPP_IPX         0x002b  /* Novell IPX */
80
#define PPP_VJC         0x002d  /* Van Jacobson Compressed TCP/IP */
81
#define PPP_VJNC        0x002f  /* Van Jacobson Uncompressed TCP/IP */
82
#define PPP_VJC_COMP    PPP_VJC
83
#define PPP_VJC_UNCOMP  PPP_VJNC
84
#define PPP_BRPDU       0x0031  /* Bridging PDU */
85
#define PPP_STII        0x0033  /* Stream Protocol (ST-II) */
86
#define PPP_VINES       0x0035  /* Banyan Vines */
87
#define PPP_IPV6        0x0057  /* Internet Protocol Version 6 */
88
#define PPP_COMP        0x00fd  /* compressed packet */
89
 
90
#define PPP_HELLO       0x0201  /* 802.1d Hello Packets */
91
#define PPP_LUXCOM      0x0231  /* Luxcom */
92
#define PPP_SNS         0x0233  /* Sigma Network Systems */
93
 
94
#define PPP_IPCP        0x8021  /* IP Control Protocol */
95
#define PPP_OSICP       0x8023  /* OSI Network Layer Control Protocol */
96
#define PPP_NSCP        0x8025  /* Xerox NS IDP Control Protocol */
97
#define PPP_DECNETCP    0x8027  /* DECnet Control Protocol */
98
#define PPP_ATCP	0x8029	/* AppleTalk Control Protocol */
99
#define PPP_IPXCP       0x802b  /* IPX Control Protocol */
100
#define PPP_STIICP      0x8033  /* Strean Protocol Control Protocol */
101
#define PPP_VINESCP     0x8035  /* Banyan Vines Control Protocol */
102
#define PPP_CCP         0x80fd  /* Compression Control Protocol */
103
 
104
#define PPP_LCP         0xc021  /* Link Control Protocol */
105
#define PPP_PAP		0xc023	/* Password Authentication Protocol */
106
#define PPP_LQR		0xc025	/* Link Quality Report protocol */
107
#define PPP_CHAP	0xc223	/* Cryptographic Handshake Auth. Protocol */
108
#define PPP_CBCP	0xc029	/* Callback Control Protocol */
109
 
110
/*
111
 * Values for FCS calculations.
112
 */
113
#define PPP_INITFCS	0xffff	/* Initial FCS value */
114
#define PPP_GOODFCS	0xf0b8	/* Good final FCS value */
115
#define PPP_FCS(fcs, c)	(((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff])
116
 
117
/*
118
 * A 32-bit unsigned integral type.
119
 */
120
#if !defined(__BIT_TYPES_DEFINED__) && !defined(_BITYPES) && !defined(__SYS_WTYPES_H)
121
  #ifdef UINT32_T
122
    typedef UINT32_T       u_int32_t;
123
  #else
124
    typedef unsigned long  u_int32_t;
125
  #endif
126
#endif
127
 
128
/*
129
 * Extended asyncmap - allows any character to be escaped.
130
 */
131
typedef u_int32_t  ext_accm[8];
132
 
133
/*
134
 * What to do with network protocol (NP) packets.
135
 */
136
enum NPmode {
137
    NPMODE_PASS,		/* pass the packet through */
138
    NPMODE_DROP,		/* silently drop the packet */
139
    NPMODE_ERROR,		/* return an error */
140
    NPMODE_QUEUE		/* save it up for later. */
141
};
142
 
143
/*
144
 * Statistics.
145
 */
146
struct pppstat	{
147
    unsigned int ppp_ibytes;	/* bytes received */
148
    unsigned int ppp_ipackets;	/* packets received */
149
    unsigned int ppp_ierrors;	/* receive errors */
150
    unsigned int ppp_obytes;	/* bytes sent */
151
    unsigned int ppp_opackets;	/* packets sent */
152
    unsigned int ppp_oerrors;	/* transmit errors */
153
};
154
 
155
struct vjstat {
156
    unsigned int vjs_packets;	/* outbound packets */
157
    unsigned int vjs_compressed; /* outbound compressed packets */
158
    unsigned int vjs_searches;	/* searches for connection state */
159
    unsigned int vjs_misses;	/* times couldn't find conn. state */
160
    unsigned int vjs_uncompressedin; /* inbound uncompressed packets */
161
    unsigned int vjs_compressedin; /* inbound compressed packets */
162
    unsigned int vjs_errorin;	/* inbound unknown type packets */
163
    unsigned int vjs_tossed;	/* inbound packets tossed because of error */
164
};
165
 
166
struct ppp_stats {
167
    struct pppstat p;		/* basic PPP statistics */
168
    struct vjstat vj;		/* VJ header compression statistics */
169
};
170
 
171
struct compstat {
172
    unsigned int unc_bytes;	/* total uncompressed bytes */
173
    unsigned int unc_packets;	/* total uncompressed packets */
174
    unsigned int comp_bytes;	/* compressed bytes */
175
    unsigned int comp_packets;	/* compressed packets */
176
    unsigned int inc_bytes;	/* incompressible bytes */
177
    unsigned int inc_packets;	/* incompressible packets */
178
    unsigned int ratio;		/* recent compression ratio << 8 */
179
};
180
 
181
struct ppp_comp_stats {
182
    struct compstat c;		/* packet compression statistics */
183
    struct compstat d;		/* packet decompression statistics */
184
};
185
 
186
/*
187
 * The following structure records the time in seconds since
188
 * the last NP packet was sent or received.
189
 */
190
struct ppp_idle {
191
    time_t xmit_idle;		/* time since last NP packet sent */
192
    time_t recv_idle;		/* time since last NP packet received */
193
};
194
 
195
#endif