111967Speter/* 211967Speter * ppp_defs.h - PPP definitions. 3139823Simp */ 4139823Simp/*- 511967Speter * Copyright (c) 1994 The Australian National University. 611967Speter * All rights reserved. 711967Speter * 811967Speter * Permission to use, copy, modify, and distribute this software and its 911967Speter * documentation is hereby granted, provided that the above copyright 1011967Speter * notice appears in all copies. This software is provided without any 1111967Speter * warranty, express or implied. The Australian National University 1211967Speter * makes no representations about the suitability of this software for 1311967Speter * any purpose. 1411967Speter * 1511967Speter * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY 1611967Speter * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 1711967Speter * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF 1811967Speter * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY 1911967Speter * OF SUCH DAMAGE. 2011967Speter * 2111967Speter * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, 2211967Speter * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 2311967Speter * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 2411967Speter * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO 2511967Speter * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, 2611967Speter * OR MODIFICATIONS. 2728415Speter * 2850477Speter * $FreeBSD$ 2911967Speter */ 3011967Speter 3111967Speter#ifndef _PPP_DEFS_H_ 3211967Speter#define _PPP_DEFS_H_ 3311967Speter 34250887Sed#include <sys/_types.h> 35250887Sed 3611967Speter/* 3711967Speter * The basic PPP frame. 3811967Speter */ 3911967Speter#define PPP_HDRLEN 4 /* octets for standard ppp header */ 4011967Speter#define PPP_FCSLEN 2 /* octets for FCS */ 4111967Speter#define PPP_MRU 1500 /* default MRU = max length of info field */ 4211967Speter 4311967Speter#define PPP_ADDRESS(p) (((u_char *)(p))[0]) 4411967Speter#define PPP_CONTROL(p) (((u_char *)(p))[1]) 4511967Speter#define PPP_PROTOCOL(p) ((((u_char *)(p))[2] << 8) + ((u_char *)(p))[3]) 4611967Speter 4711967Speter/* 4811967Speter * Significant octet values. 4911967Speter */ 5011967Speter#define PPP_ALLSTATIONS 0xff /* All-Stations broadcast address */ 5111967Speter#define PPP_UI 0x03 /* Unnumbered Information */ 5211967Speter#define PPP_FLAG 0x7e /* Flag Sequence */ 5311967Speter#define PPP_ESCAPE 0x7d /* Asynchronous Control Escape */ 5411967Speter#define PPP_TRANS 0x20 /* Asynchronous transparency modifier */ 5511967Speter 5611967Speter/* 5711967Speter * Protocol field values. 5811967Speter */ 5911967Speter#define PPP_IP 0x21 /* Internet Protocol */ 6011970Speter#define PPP_XNS 0x25 /* Xerox NS */ 6128415Speter#define PPP_AT 0x29 /* AppleTalk Protocol */ 6211970Speter#define PPP_IPX 0x2b /* IPX Datagram (RFC1552) */ 6311967Speter#define PPP_VJC_COMP 0x2d /* VJ compressed TCP */ 6411967Speter#define PPP_VJC_UNCOMP 0x2f /* VJ uncompressed TCP */ 6511967Speter#define PPP_COMP 0xfd /* compressed packet */ 6611967Speter#define PPP_IPCP 0x8021 /* IP Control Protocol */ 6728415Speter#define PPP_ATCP 0x8029 /* AppleTalk Control Protocol */ 6811970Speter#define PPP_IPXCP 0x802b /* IPX Control Protocol (RFC1552) */ 6911967Speter#define PPP_CCP 0x80fd /* Compression Control Protocol */ 7011967Speter#define PPP_LCP 0xc021 /* Link Control Protocol */ 7111967Speter#define PPP_PAP 0xc023 /* Password Authentication Protocol */ 7211967Speter#define PPP_LQR 0xc025 /* Link Quality Report protocol */ 7311967Speter#define PPP_CHAP 0xc223 /* Cryptographic Handshake Auth. Protocol */ 7428415Speter#define PPP_CBCP 0xc029 /* Callback Control Protocol */ 7578064Sume#define PPP_IPV6 0x57 /* Internet Protocol version 6*/ 7678064Sume#define PPP_IPV6CP 0x8057 /* IPv6 Control Protocol */ 7711967Speter 7811967Speter/* 7911967Speter * Values for FCS calculations. 8011967Speter */ 8111967Speter#define PPP_INITFCS 0xffff /* Initial FCS value */ 8211967Speter#define PPP_GOODFCS 0xf0b8 /* Good final FCS value */ 8311967Speter#define PPP_FCS(fcs, c) (((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff]) 8411967Speter 8511967Speter/* 8611967Speter * Extended asyncmap - allows any character to be escaped. 8711967Speter */ 88250887Sedtypedef __uint32_t ext_accm[8]; 8911967Speter 9011967Speter/* 9111967Speter * What to do with network protocol (NP) packets. 9211967Speter */ 9311967Speterenum NPmode { 9411967Speter NPMODE_PASS, /* pass the packet through */ 9511967Speter NPMODE_DROP, /* silently drop the packet */ 9611967Speter NPMODE_ERROR, /* return an error */ 9711967Speter NPMODE_QUEUE /* save it up for later. */ 9811967Speter}; 9911967Speter 10011967Speter/* 10111967Speter * Statistics. 10211967Speter */ 10311967Speterstruct pppstat { 10428415Speter unsigned int ppp_ibytes; /* bytes received */ 10528415Speter unsigned int ppp_ipackets; /* packets received */ 10628415Speter unsigned int ppp_ierrors; /* receive errors */ 10728415Speter unsigned int ppp_obytes; /* bytes sent */ 10828415Speter unsigned int ppp_opackets; /* packets sent */ 10928415Speter unsigned int ppp_oerrors; /* transmit errors */ 11011967Speter}; 11111967Speter 11211967Speterstruct vjstat { 11328415Speter unsigned int vjs_packets; /* outbound packets */ 11428415Speter unsigned int vjs_compressed; /* outbound compressed packets */ 11528415Speter unsigned int vjs_searches; /* searches for connection state */ 11628415Speter unsigned int vjs_misses; /* times couldn't find conn. state */ 11728415Speter unsigned int vjs_uncompressedin; /* inbound uncompressed packets */ 11828415Speter unsigned int vjs_compressedin; /* inbound compressed packets */ 11928415Speter unsigned int vjs_errorin; /* inbound unknown type packets */ 12028415Speter unsigned int vjs_tossed; /* inbound packets tossed because of error */ 12111967Speter}; 12211967Speter 12311967Speterstruct ppp_stats { 12428415Speter struct pppstat p; /* basic PPP statistics */ 12528415Speter struct vjstat vj; /* VJ header compression statistics */ 12611967Speter}; 12711967Speter 12811967Speterstruct compstat { 12928415Speter unsigned int unc_bytes; /* total uncompressed bytes */ 13028415Speter unsigned int unc_packets; /* total uncompressed packets */ 13128415Speter unsigned int comp_bytes; /* compressed bytes */ 13228415Speter unsigned int comp_packets; /* compressed packets */ 13328415Speter unsigned int inc_bytes; /* incompressible bytes */ 13428415Speter unsigned int inc_packets; /* incompressible packets */ 13528415Speter unsigned int ratio; /* recent compression ratio << 8 */ 13611967Speter}; 13711967Speter 13811967Speterstruct ppp_comp_stats { 13928415Speter struct compstat c; /* packet compression statistics */ 14028415Speter struct compstat d; /* packet decompression statistics */ 14111967Speter}; 14211967Speter 14311967Speter/* 14411967Speter * The following structure records the time in seconds since 14511967Speter * the last NP packet was sent or received. 14611967Speter */ 14711967Speterstruct ppp_idle { 148250887Sed __time_t xmit_idle; /* time since last NP packet sent */ 149250887Sed __time_t recv_idle; /* time since last NP packet received */ 15011967Speter}; 15111967Speter 15211967Speter#ifndef __P 15311967Speter#ifdef __STDC__ 15411967Speter#define __P(x) x 15511967Speter#else 15611967Speter#define __P(x) () 15711967Speter#endif 15811967Speter#endif 15911967Speter 16011967Speter#endif /* _PPP_DEFS_H_ */ 161