1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2*4882a593Smuzhiyun /* 3*4882a593Smuzhiyun * ppp_defs.h - PPP definitions. 4*4882a593Smuzhiyun * 5*4882a593Smuzhiyun * Copyright 1994-2000 Paul Mackerras. 6*4882a593Smuzhiyun * 7*4882a593Smuzhiyun * This program is free software; you can redistribute it and/or 8*4882a593Smuzhiyun * modify it under the terms of the GNU General Public License 9*4882a593Smuzhiyun * version 2 as published by the Free Software Foundation. 10*4882a593Smuzhiyun */ 11*4882a593Smuzhiyun #include <linux/types.h> 12*4882a593Smuzhiyun 13*4882a593Smuzhiyun #ifndef _UAPI_PPP_DEFS_H_ 14*4882a593Smuzhiyun #define _UAPI_PPP_DEFS_H_ 15*4882a593Smuzhiyun 16*4882a593Smuzhiyun /* 17*4882a593Smuzhiyun * The basic PPP frame. 18*4882a593Smuzhiyun */ 19*4882a593Smuzhiyun #define PPP_HDRLEN 4 /* octets for standard ppp header */ 20*4882a593Smuzhiyun #define PPP_FCSLEN 2 /* octets for FCS */ 21*4882a593Smuzhiyun #define PPP_MRU 1500 /* default MRU = max length of info field */ 22*4882a593Smuzhiyun 23*4882a593Smuzhiyun #define PPP_ADDRESS(p) (((__u8 *)(p))[0]) 24*4882a593Smuzhiyun #define PPP_CONTROL(p) (((__u8 *)(p))[1]) 25*4882a593Smuzhiyun #define PPP_PROTOCOL(p) ((((__u8 *)(p))[2] << 8) + ((__u8 *)(p))[3]) 26*4882a593Smuzhiyun 27*4882a593Smuzhiyun /* 28*4882a593Smuzhiyun * Significant octet values. 29*4882a593Smuzhiyun */ 30*4882a593Smuzhiyun #define PPP_ALLSTATIONS 0xff /* All-Stations broadcast address */ 31*4882a593Smuzhiyun #define PPP_UI 0x03 /* Unnumbered Information */ 32*4882a593Smuzhiyun #define PPP_FLAG 0x7e /* Flag Sequence */ 33*4882a593Smuzhiyun #define PPP_ESCAPE 0x7d /* Asynchronous Control Escape */ 34*4882a593Smuzhiyun #define PPP_TRANS 0x20 /* Asynchronous transparency modifier */ 35*4882a593Smuzhiyun 36*4882a593Smuzhiyun /* 37*4882a593Smuzhiyun * Protocol field values. 38*4882a593Smuzhiyun */ 39*4882a593Smuzhiyun #define PPP_IP 0x21 /* Internet Protocol */ 40*4882a593Smuzhiyun #define PPP_AT 0x29 /* AppleTalk Protocol */ 41*4882a593Smuzhiyun #define PPP_IPX 0x2b /* IPX protocol */ 42*4882a593Smuzhiyun #define PPP_VJC_COMP 0x2d /* VJ compressed TCP */ 43*4882a593Smuzhiyun #define PPP_VJC_UNCOMP 0x2f /* VJ uncompressed TCP */ 44*4882a593Smuzhiyun #define PPP_MP 0x3d /* Multilink protocol */ 45*4882a593Smuzhiyun #define PPP_IPV6 0x57 /* Internet Protocol Version 6 */ 46*4882a593Smuzhiyun #define PPP_COMPFRAG 0xfb /* fragment compressed below bundle */ 47*4882a593Smuzhiyun #define PPP_COMP 0xfd /* compressed packet */ 48*4882a593Smuzhiyun #define PPP_MPLS_UC 0x0281 /* Multi Protocol Label Switching - Unicast */ 49*4882a593Smuzhiyun #define PPP_MPLS_MC 0x0283 /* Multi Protocol Label Switching - Multicast */ 50*4882a593Smuzhiyun #define PPP_IPCP 0x8021 /* IP Control Protocol */ 51*4882a593Smuzhiyun #define PPP_ATCP 0x8029 /* AppleTalk Control Protocol */ 52*4882a593Smuzhiyun #define PPP_IPXCP 0x802b /* IPX Control Protocol */ 53*4882a593Smuzhiyun #define PPP_IPV6CP 0x8057 /* IPv6 Control Protocol */ 54*4882a593Smuzhiyun #define PPP_CCPFRAG 0x80fb /* CCP at link level (below MP bundle) */ 55*4882a593Smuzhiyun #define PPP_CCP 0x80fd /* Compression Control Protocol */ 56*4882a593Smuzhiyun #define PPP_MPLSCP 0x80fd /* MPLS Control Protocol */ 57*4882a593Smuzhiyun #define PPP_LCP 0xc021 /* Link Control Protocol */ 58*4882a593Smuzhiyun #define PPP_PAP 0xc023 /* Password Authentication Protocol */ 59*4882a593Smuzhiyun #define PPP_LQR 0xc025 /* Link Quality Report protocol */ 60*4882a593Smuzhiyun #define PPP_CHAP 0xc223 /* Cryptographic Handshake Auth. Protocol */ 61*4882a593Smuzhiyun #define PPP_CBCP 0xc029 /* Callback Control Protocol */ 62*4882a593Smuzhiyun 63*4882a593Smuzhiyun /* 64*4882a593Smuzhiyun * Values for FCS calculations. 65*4882a593Smuzhiyun */ 66*4882a593Smuzhiyun 67*4882a593Smuzhiyun #define PPP_INITFCS 0xffff /* Initial FCS value */ 68*4882a593Smuzhiyun #define PPP_GOODFCS 0xf0b8 /* Good final FCS value */ 69*4882a593Smuzhiyun 70*4882a593Smuzhiyun 71*4882a593Smuzhiyun /* 72*4882a593Smuzhiyun * Extended asyncmap - allows any character to be escaped. 73*4882a593Smuzhiyun */ 74*4882a593Smuzhiyun 75*4882a593Smuzhiyun typedef __u32 ext_accm[8]; 76*4882a593Smuzhiyun 77*4882a593Smuzhiyun /* 78*4882a593Smuzhiyun * What to do with network protocol (NP) packets. 79*4882a593Smuzhiyun */ 80*4882a593Smuzhiyun enum NPmode { 81*4882a593Smuzhiyun NPMODE_PASS, /* pass the packet through */ 82*4882a593Smuzhiyun NPMODE_DROP, /* silently drop the packet */ 83*4882a593Smuzhiyun NPMODE_ERROR, /* return an error */ 84*4882a593Smuzhiyun NPMODE_QUEUE /* save it up for later. */ 85*4882a593Smuzhiyun }; 86*4882a593Smuzhiyun 87*4882a593Smuzhiyun /* 88*4882a593Smuzhiyun * Statistics for LQRP and pppstats 89*4882a593Smuzhiyun */ 90*4882a593Smuzhiyun struct pppstat { 91*4882a593Smuzhiyun __u32 ppp_discards; /* # frames discarded */ 92*4882a593Smuzhiyun 93*4882a593Smuzhiyun __u32 ppp_ibytes; /* bytes received */ 94*4882a593Smuzhiyun __u32 ppp_ioctects; /* bytes received not in error */ 95*4882a593Smuzhiyun __u32 ppp_ipackets; /* packets received */ 96*4882a593Smuzhiyun __u32 ppp_ierrors; /* receive errors */ 97*4882a593Smuzhiyun __u32 ppp_ilqrs; /* # LQR frames received */ 98*4882a593Smuzhiyun 99*4882a593Smuzhiyun __u32 ppp_obytes; /* raw bytes sent */ 100*4882a593Smuzhiyun __u32 ppp_ooctects; /* frame bytes sent */ 101*4882a593Smuzhiyun __u32 ppp_opackets; /* packets sent */ 102*4882a593Smuzhiyun __u32 ppp_oerrors; /* transmit errors */ 103*4882a593Smuzhiyun __u32 ppp_olqrs; /* # LQR frames sent */ 104*4882a593Smuzhiyun }; 105*4882a593Smuzhiyun 106*4882a593Smuzhiyun struct vjstat { 107*4882a593Smuzhiyun __u32 vjs_packets; /* outbound packets */ 108*4882a593Smuzhiyun __u32 vjs_compressed; /* outbound compressed packets */ 109*4882a593Smuzhiyun __u32 vjs_searches; /* searches for connection state */ 110*4882a593Smuzhiyun __u32 vjs_misses; /* times couldn't find conn. state */ 111*4882a593Smuzhiyun __u32 vjs_uncompressedin; /* inbound uncompressed packets */ 112*4882a593Smuzhiyun __u32 vjs_compressedin; /* inbound compressed packets */ 113*4882a593Smuzhiyun __u32 vjs_errorin; /* inbound unknown type packets */ 114*4882a593Smuzhiyun __u32 vjs_tossed; /* inbound packets tossed because of error */ 115*4882a593Smuzhiyun }; 116*4882a593Smuzhiyun 117*4882a593Smuzhiyun struct compstat { 118*4882a593Smuzhiyun __u32 unc_bytes; /* total uncompressed bytes */ 119*4882a593Smuzhiyun __u32 unc_packets; /* total uncompressed packets */ 120*4882a593Smuzhiyun __u32 comp_bytes; /* compressed bytes */ 121*4882a593Smuzhiyun __u32 comp_packets; /* compressed packets */ 122*4882a593Smuzhiyun __u32 inc_bytes; /* incompressible bytes */ 123*4882a593Smuzhiyun __u32 inc_packets; /* incompressible packets */ 124*4882a593Smuzhiyun 125*4882a593Smuzhiyun /* the compression ratio is defined as in_count / bytes_out */ 126*4882a593Smuzhiyun __u32 in_count; /* Bytes received */ 127*4882a593Smuzhiyun __u32 bytes_out; /* Bytes transmitted */ 128*4882a593Smuzhiyun 129*4882a593Smuzhiyun double ratio; /* not computed in kernel. */ 130*4882a593Smuzhiyun }; 131*4882a593Smuzhiyun 132*4882a593Smuzhiyun struct ppp_stats { 133*4882a593Smuzhiyun struct pppstat p; /* basic PPP statistics */ 134*4882a593Smuzhiyun struct vjstat vj; /* VJ header compression statistics */ 135*4882a593Smuzhiyun }; 136*4882a593Smuzhiyun 137*4882a593Smuzhiyun struct ppp_comp_stats { 138*4882a593Smuzhiyun struct compstat c; /* packet compression statistics */ 139*4882a593Smuzhiyun struct compstat d; /* packet decompression statistics */ 140*4882a593Smuzhiyun }; 141*4882a593Smuzhiyun 142*4882a593Smuzhiyun /* 143*4882a593Smuzhiyun * The following structure records the time in seconds since 144*4882a593Smuzhiyun * the last NP packet was sent or received. 145*4882a593Smuzhiyun * 146*4882a593Smuzhiyun * Linux implements both 32-bit and 64-bit time_t versions 147*4882a593Smuzhiyun * for compatibility with user space that defines ppp_idle 148*4882a593Smuzhiyun * based on the libc time_t. 149*4882a593Smuzhiyun */ 150*4882a593Smuzhiyun struct ppp_idle { 151*4882a593Smuzhiyun __kernel_old_time_t xmit_idle; /* time since last NP packet sent */ 152*4882a593Smuzhiyun __kernel_old_time_t recv_idle; /* time since last NP packet received */ 153*4882a593Smuzhiyun }; 154*4882a593Smuzhiyun 155*4882a593Smuzhiyun struct ppp_idle32 { 156*4882a593Smuzhiyun __s32 xmit_idle; /* time since last NP packet sent */ 157*4882a593Smuzhiyun __s32 recv_idle; /* time since last NP packet received */ 158*4882a593Smuzhiyun }; 159*4882a593Smuzhiyun 160*4882a593Smuzhiyun struct ppp_idle64 { 161*4882a593Smuzhiyun __s64 xmit_idle; /* time since last NP packet sent */ 162*4882a593Smuzhiyun __s64 recv_idle; /* time since last NP packet received */ 163*4882a593Smuzhiyun }; 164*4882a593Smuzhiyun 165*4882a593Smuzhiyun #endif /* _UAPI_PPP_DEFS_H_ */ 166