1*53ee8cc1Swenshuai.xi /* $Id: ppp_defs.h,v 1.2 1994/09/21 01:31:06 paulus Exp $ */ 2*53ee8cc1Swenshuai.xi 3*53ee8cc1Swenshuai.xi /* 4*53ee8cc1Swenshuai.xi * ppp_defs.h - PPP definitions. 5*53ee8cc1Swenshuai.xi * 6*53ee8cc1Swenshuai.xi * Copyright (c) 1994 The Australian National University. 7*53ee8cc1Swenshuai.xi * All rights reserved. 8*53ee8cc1Swenshuai.xi * 9*53ee8cc1Swenshuai.xi * Permission to use, copy, modify, and distribute this software and its 10*53ee8cc1Swenshuai.xi * documentation is hereby granted, provided that the above copyright 11*53ee8cc1Swenshuai.xi * notice appears in all copies. This software is provided without any 12*53ee8cc1Swenshuai.xi * warranty, express or implied. The Australian National University 13*53ee8cc1Swenshuai.xi * makes no representations about the suitability of this software for 14*53ee8cc1Swenshuai.xi * any purpose. 15*53ee8cc1Swenshuai.xi * 16*53ee8cc1Swenshuai.xi * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY 17*53ee8cc1Swenshuai.xi * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 18*53ee8cc1Swenshuai.xi * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF 19*53ee8cc1Swenshuai.xi * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY 20*53ee8cc1Swenshuai.xi * OF SUCH DAMAGE. 21*53ee8cc1Swenshuai.xi * 22*53ee8cc1Swenshuai.xi * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, 23*53ee8cc1Swenshuai.xi * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 24*53ee8cc1Swenshuai.xi * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 25*53ee8cc1Swenshuai.xi * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO 26*53ee8cc1Swenshuai.xi * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, 27*53ee8cc1Swenshuai.xi * OR MODIFICATIONS. 28*53ee8cc1Swenshuai.xi */ 29*53ee8cc1Swenshuai.xi 30*53ee8cc1Swenshuai.xi /* 31*53ee8cc1Swenshuai.xi * ==FILEVERSION 20000114== 32*53ee8cc1Swenshuai.xi * 33*53ee8cc1Swenshuai.xi * NOTE TO MAINTAINERS: 34*53ee8cc1Swenshuai.xi * If you modify this file at all, please set the above date. 35*53ee8cc1Swenshuai.xi * ppp_defs.h is shipped with a PPP distribution as well as with the kernel; 36*53ee8cc1Swenshuai.xi * if everyone increases the FILEVERSION number above, then scripts 37*53ee8cc1Swenshuai.xi * can do the right thing when deciding whether to install a new ppp_defs.h 38*53ee8cc1Swenshuai.xi * file. Don't change the format of that line otherwise, so the 39*53ee8cc1Swenshuai.xi * installation script can recognize it. 40*53ee8cc1Swenshuai.xi */ 41*53ee8cc1Swenshuai.xi 42*53ee8cc1Swenshuai.xi #ifndef _PPP_DEFS_H_ 43*53ee8cc1Swenshuai.xi #define _PPP_DEFS_H_ 44*53ee8cc1Swenshuai.xi 45*53ee8cc1Swenshuai.xi /* 46*53ee8cc1Swenshuai.xi * The basic PPP frame. 47*53ee8cc1Swenshuai.xi */ 48*53ee8cc1Swenshuai.xi #define PPP_HDRLEN 4 /* octets for standard ppp header */ 49*53ee8cc1Swenshuai.xi #define PPP_FCSLEN 2 /* octets for FCS */ 50*53ee8cc1Swenshuai.xi #define PPP_MRU 1500 /* default MRU = max length of info field */ 51*53ee8cc1Swenshuai.xi 52*53ee8cc1Swenshuai.xi #define PPP_ADDRESS(p) (((__u8 *)(p))[0]) 53*53ee8cc1Swenshuai.xi #define PPP_CONTROL(p) (((__u8 *)(p))[1]) 54*53ee8cc1Swenshuai.xi #define PPP_PROTOCOL(p) ((((__u8 *)(p))[2] << 8) + ((__u8 *)(p))[3]) 55*53ee8cc1Swenshuai.xi 56*53ee8cc1Swenshuai.xi /* 57*53ee8cc1Swenshuai.xi * Significant octet values. 58*53ee8cc1Swenshuai.xi */ 59*53ee8cc1Swenshuai.xi #define PPP_ALLSTATIONS 0xff /* All-Stations broadcast address */ 60*53ee8cc1Swenshuai.xi #define PPP_UI 0x03 /* Unnumbered Information */ 61*53ee8cc1Swenshuai.xi #define PPP_FLAG 0x7e /* Flag Sequence */ 62*53ee8cc1Swenshuai.xi #define PPP_ESCAPE 0x7d /* Asynchronous Control Escape */ 63*53ee8cc1Swenshuai.xi #define PPP_TRANS 0x20 /* Asynchronous transparency modifier */ 64*53ee8cc1Swenshuai.xi 65*53ee8cc1Swenshuai.xi /* 66*53ee8cc1Swenshuai.xi * Protocol field values. 67*53ee8cc1Swenshuai.xi */ 68*53ee8cc1Swenshuai.xi #define PPP_IP 0x21 /* Internet Protocol */ 69*53ee8cc1Swenshuai.xi #define PPP_AT 0x29 /* AppleTalk Protocol */ 70*53ee8cc1Swenshuai.xi #define PPP_IPX 0x2b /* IPX protocol */ 71*53ee8cc1Swenshuai.xi #define PPP_VJC_COMP 0x2d /* VJ compressed TCP */ 72*53ee8cc1Swenshuai.xi #define PPP_VJC_UNCOMP 0x2f /* VJ uncompressed TCP */ 73*53ee8cc1Swenshuai.xi #define PPP_MP 0x3d /* Multilink protocol */ 74*53ee8cc1Swenshuai.xi #define PPP_IPV6 0x57 /* Internet Protocol Version 6 */ 75*53ee8cc1Swenshuai.xi #define PPP_COMPFRAG 0xfb /* fragment compressed below bundle */ 76*53ee8cc1Swenshuai.xi #define PPP_COMP 0xfd /* compressed packet */ 77*53ee8cc1Swenshuai.xi #define PPP_MPLS_UC 0x0281 /* Multi Protocol Label Switching - Unicast */ 78*53ee8cc1Swenshuai.xi #define PPP_MPLS_MC 0x0283 /* Multi Protocol Label Switching - Multicast */ 79*53ee8cc1Swenshuai.xi #define PPP_IPCP 0x8021 /* IP Control Protocol */ 80*53ee8cc1Swenshuai.xi #define PPP_ATCP 0x8029 /* AppleTalk Control Protocol */ 81*53ee8cc1Swenshuai.xi #define PPP_IPXCP 0x802b /* IPX Control Protocol */ 82*53ee8cc1Swenshuai.xi #define PPP_IPV6CP 0x8057 /* IPv6 Control Protocol */ 83*53ee8cc1Swenshuai.xi #define PPP_CCPFRAG 0x80fb /* CCP at link level (below MP bundle) */ 84*53ee8cc1Swenshuai.xi #define PPP_CCP 0x80fd /* Compression Control Protocol */ 85*53ee8cc1Swenshuai.xi #define PPP_MPLSCP 0x80fd /* MPLS Control Protocol */ 86*53ee8cc1Swenshuai.xi #define PPP_LCP 0xc021 /* Link Control Protocol */ 87*53ee8cc1Swenshuai.xi #define PPP_PAP 0xc023 /* Password Authentication Protocol */ 88*53ee8cc1Swenshuai.xi #define PPP_LQR 0xc025 /* Link Quality Report protocol */ 89*53ee8cc1Swenshuai.xi #define PPP_CHAP 0xc223 /* Cryptographic Handshake Auth. Protocol */ 90*53ee8cc1Swenshuai.xi #define PPP_CBCP 0xc029 /* Callback Control Protocol */ 91*53ee8cc1Swenshuai.xi 92*53ee8cc1Swenshuai.xi /* 93*53ee8cc1Swenshuai.xi * Values for FCS calculations. 94*53ee8cc1Swenshuai.xi */ 95*53ee8cc1Swenshuai.xi 96*53ee8cc1Swenshuai.xi #define PPP_INITFCS 0xffff /* Initial FCS value */ 97*53ee8cc1Swenshuai.xi #define PPP_GOODFCS 0xf0b8 /* Good final FCS value */ 98*53ee8cc1Swenshuai.xi 99*53ee8cc1Swenshuai.xi 100*53ee8cc1Swenshuai.xi /* 101*53ee8cc1Swenshuai.xi * Extended asyncmap - allows any character to be escaped. 102*53ee8cc1Swenshuai.xi */ 103*53ee8cc1Swenshuai.xi 104*53ee8cc1Swenshuai.xi typedef __u32 ext_accm[8]; 105*53ee8cc1Swenshuai.xi 106*53ee8cc1Swenshuai.xi /* 107*53ee8cc1Swenshuai.xi * What to do with network protocol (NP) packets. 108*53ee8cc1Swenshuai.xi */ 109*53ee8cc1Swenshuai.xi enum NPmode { 110*53ee8cc1Swenshuai.xi NPMODE_PASS, /* pass the packet through */ 111*53ee8cc1Swenshuai.xi NPMODE_DROP, /* silently drop the packet */ 112*53ee8cc1Swenshuai.xi NPMODE_ERROR, /* return an error */ 113*53ee8cc1Swenshuai.xi NPMODE_QUEUE /* save it up for later. */ 114*53ee8cc1Swenshuai.xi }; 115*53ee8cc1Swenshuai.xi 116*53ee8cc1Swenshuai.xi /* 117*53ee8cc1Swenshuai.xi * Statistics for LQRP and pppstats 118*53ee8cc1Swenshuai.xi */ 119*53ee8cc1Swenshuai.xi struct pppstat { 120*53ee8cc1Swenshuai.xi __u32 ppp_discards; /* # frames discarded */ 121*53ee8cc1Swenshuai.xi 122*53ee8cc1Swenshuai.xi __u32 ppp_ibytes; /* bytes received */ 123*53ee8cc1Swenshuai.xi __u32 ppp_ioctects; /* bytes received not in error */ 124*53ee8cc1Swenshuai.xi __u32 ppp_ipackets; /* packets received */ 125*53ee8cc1Swenshuai.xi __u32 ppp_ierrors; /* receive errors */ 126*53ee8cc1Swenshuai.xi __u32 ppp_ilqrs; /* # LQR frames received */ 127*53ee8cc1Swenshuai.xi 128*53ee8cc1Swenshuai.xi __u32 ppp_obytes; /* raw bytes sent */ 129*53ee8cc1Swenshuai.xi __u32 ppp_ooctects; /* frame bytes sent */ 130*53ee8cc1Swenshuai.xi __u32 ppp_opackets; /* packets sent */ 131*53ee8cc1Swenshuai.xi __u32 ppp_oerrors; /* transmit errors */ 132*53ee8cc1Swenshuai.xi __u32 ppp_olqrs; /* # LQR frames sent */ 133*53ee8cc1Swenshuai.xi }; 134*53ee8cc1Swenshuai.xi 135*53ee8cc1Swenshuai.xi struct vjstat { 136*53ee8cc1Swenshuai.xi __u32 vjs_packets; /* outbound packets */ 137*53ee8cc1Swenshuai.xi __u32 vjs_compressed; /* outbound compressed packets */ 138*53ee8cc1Swenshuai.xi __u32 vjs_searches; /* searches for connection state */ 139*53ee8cc1Swenshuai.xi __u32 vjs_misses; /* times couldn't find conn. state */ 140*53ee8cc1Swenshuai.xi __u32 vjs_uncompressedin; /* inbound uncompressed packets */ 141*53ee8cc1Swenshuai.xi __u32 vjs_compressedin; /* inbound compressed packets */ 142*53ee8cc1Swenshuai.xi __u32 vjs_errorin; /* inbound unknown type packets */ 143*53ee8cc1Swenshuai.xi __u32 vjs_tossed; /* inbound packets tossed because of error */ 144*53ee8cc1Swenshuai.xi }; 145*53ee8cc1Swenshuai.xi 146*53ee8cc1Swenshuai.xi struct compstat { 147*53ee8cc1Swenshuai.xi __u32 unc_bytes; /* total uncompressed bytes */ 148*53ee8cc1Swenshuai.xi __u32 unc_packets; /* total uncompressed packets */ 149*53ee8cc1Swenshuai.xi __u32 comp_bytes; /* compressed bytes */ 150*53ee8cc1Swenshuai.xi __u32 comp_packets; /* compressed packets */ 151*53ee8cc1Swenshuai.xi __u32 inc_bytes; /* incompressible bytes */ 152*53ee8cc1Swenshuai.xi __u32 inc_packets; /* incompressible packets */ 153*53ee8cc1Swenshuai.xi 154*53ee8cc1Swenshuai.xi /* the compression ratio is defined as in_count / bytes_out */ 155*53ee8cc1Swenshuai.xi __u32 in_count; /* Bytes received */ 156*53ee8cc1Swenshuai.xi __u32 bytes_out; /* Bytes transmitted */ 157*53ee8cc1Swenshuai.xi 158*53ee8cc1Swenshuai.xi double ratio; /* not computed in kernel. */ 159*53ee8cc1Swenshuai.xi }; 160*53ee8cc1Swenshuai.xi 161*53ee8cc1Swenshuai.xi struct ppp_stats { 162*53ee8cc1Swenshuai.xi struct pppstat p; /* basic PPP statistics */ 163*53ee8cc1Swenshuai.xi struct vjstat vj; /* VJ header compression statistics */ 164*53ee8cc1Swenshuai.xi }; 165*53ee8cc1Swenshuai.xi 166*53ee8cc1Swenshuai.xi struct ppp_comp_stats { 167*53ee8cc1Swenshuai.xi struct compstat c; /* packet compression statistics */ 168*53ee8cc1Swenshuai.xi struct compstat d; /* packet decompression statistics */ 169*53ee8cc1Swenshuai.xi }; 170*53ee8cc1Swenshuai.xi 171*53ee8cc1Swenshuai.xi /* 172*53ee8cc1Swenshuai.xi * The following structure records the time in seconds since 173*53ee8cc1Swenshuai.xi * the last NP packet was sent or received. 174*53ee8cc1Swenshuai.xi */ 175*53ee8cc1Swenshuai.xi struct ppp_idle { 176*53ee8cc1Swenshuai.xi time_t xmit_idle; /* time since last NP packet sent */ 177*53ee8cc1Swenshuai.xi time_t recv_idle; /* time since last NP packet received */ 178*53ee8cc1Swenshuai.xi }; 179*53ee8cc1Swenshuai.xi 180*53ee8cc1Swenshuai.xi #endif /* _PPP_DEFS_H_ */ 181