1e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2607ca46eSDavid Howells /* 3607ca46eSDavid Howells * ppp_defs.h - PPP definitions. 4607ca46eSDavid Howells * 5607ca46eSDavid Howells * Copyright 1994-2000 Paul Mackerras. 6607ca46eSDavid Howells * 7607ca46eSDavid Howells * This program is free software; you can redistribute it and/or 8607ca46eSDavid Howells * modify it under the terms of the GNU General Public License 9607ca46eSDavid Howells * version 2 as published by the Free Software Foundation. 10607ca46eSDavid Howells */ 11607ca46eSDavid Howells #include <linux/types.h> 12607ca46eSDavid Howells 13607ca46eSDavid Howells #ifndef _UAPI_PPP_DEFS_H_ 14607ca46eSDavid Howells #define _UAPI_PPP_DEFS_H_ 15607ca46eSDavid Howells 16607ca46eSDavid Howells /* 17607ca46eSDavid Howells * The basic PPP frame. 18607ca46eSDavid Howells */ 19607ca46eSDavid Howells #define PPP_HDRLEN 4 /* octets for standard ppp header */ 20607ca46eSDavid Howells #define PPP_FCSLEN 2 /* octets for FCS */ 21607ca46eSDavid Howells #define PPP_MRU 1500 /* default MRU = max length of info field */ 22607ca46eSDavid Howells 23607ca46eSDavid Howells #define PPP_ADDRESS(p) (((__u8 *)(p))[0]) 24607ca46eSDavid Howells #define PPP_CONTROL(p) (((__u8 *)(p))[1]) 25607ca46eSDavid Howells #define PPP_PROTOCOL(p) ((((__u8 *)(p))[2] << 8) + ((__u8 *)(p))[3]) 26607ca46eSDavid Howells 27607ca46eSDavid Howells /* 28607ca46eSDavid Howells * Significant octet values. 29607ca46eSDavid Howells */ 30607ca46eSDavid Howells #define PPP_ALLSTATIONS 0xff /* All-Stations broadcast address */ 31607ca46eSDavid Howells #define PPP_UI 0x03 /* Unnumbered Information */ 32607ca46eSDavid Howells #define PPP_FLAG 0x7e /* Flag Sequence */ 33607ca46eSDavid Howells #define PPP_ESCAPE 0x7d /* Asynchronous Control Escape */ 34607ca46eSDavid Howells #define PPP_TRANS 0x20 /* Asynchronous transparency modifier */ 35607ca46eSDavid Howells 36607ca46eSDavid Howells /* 37607ca46eSDavid Howells * Protocol field values. 38607ca46eSDavid Howells */ 39607ca46eSDavid Howells #define PPP_IP 0x21 /* Internet Protocol */ 40607ca46eSDavid Howells #define PPP_AT 0x29 /* AppleTalk Protocol */ 41607ca46eSDavid Howells #define PPP_IPX 0x2b /* IPX protocol */ 42607ca46eSDavid Howells #define PPP_VJC_COMP 0x2d /* VJ compressed TCP */ 43607ca46eSDavid Howells #define PPP_VJC_UNCOMP 0x2f /* VJ uncompressed TCP */ 44607ca46eSDavid Howells #define PPP_MP 0x3d /* Multilink protocol */ 45607ca46eSDavid Howells #define PPP_IPV6 0x57 /* Internet Protocol Version 6 */ 46607ca46eSDavid Howells #define PPP_COMPFRAG 0xfb /* fragment compressed below bundle */ 47607ca46eSDavid Howells #define PPP_COMP 0xfd /* compressed packet */ 48607ca46eSDavid Howells #define PPP_MPLS_UC 0x0281 /* Multi Protocol Label Switching - Unicast */ 49607ca46eSDavid Howells #define PPP_MPLS_MC 0x0283 /* Multi Protocol Label Switching - Multicast */ 50607ca46eSDavid Howells #define PPP_IPCP 0x8021 /* IP Control Protocol */ 51607ca46eSDavid Howells #define PPP_ATCP 0x8029 /* AppleTalk Control Protocol */ 52607ca46eSDavid Howells #define PPP_IPXCP 0x802b /* IPX Control Protocol */ 53607ca46eSDavid Howells #define PPP_IPV6CP 0x8057 /* IPv6 Control Protocol */ 54607ca46eSDavid Howells #define PPP_CCPFRAG 0x80fb /* CCP at link level (below MP bundle) */ 55607ca46eSDavid Howells #define PPP_CCP 0x80fd /* Compression Control Protocol */ 56607ca46eSDavid Howells #define PPP_MPLSCP 0x80fd /* MPLS Control Protocol */ 57607ca46eSDavid Howells #define PPP_LCP 0xc021 /* Link Control Protocol */ 58607ca46eSDavid Howells #define PPP_PAP 0xc023 /* Password Authentication Protocol */ 59607ca46eSDavid Howells #define PPP_LQR 0xc025 /* Link Quality Report protocol */ 60607ca46eSDavid Howells #define PPP_CHAP 0xc223 /* Cryptographic Handshake Auth. Protocol */ 61607ca46eSDavid Howells #define PPP_CBCP 0xc029 /* Callback Control Protocol */ 62607ca46eSDavid Howells 63607ca46eSDavid Howells /* 64607ca46eSDavid Howells * Values for FCS calculations. 65607ca46eSDavid Howells */ 66607ca46eSDavid Howells 67607ca46eSDavid Howells #define PPP_INITFCS 0xffff /* Initial FCS value */ 68607ca46eSDavid Howells #define PPP_GOODFCS 0xf0b8 /* Good final FCS value */ 69607ca46eSDavid Howells 70607ca46eSDavid Howells 71607ca46eSDavid Howells /* 72607ca46eSDavid Howells * Extended asyncmap - allows any character to be escaped. 73607ca46eSDavid Howells */ 74607ca46eSDavid Howells 75607ca46eSDavid Howells typedef __u32 ext_accm[8]; 76607ca46eSDavid Howells 77607ca46eSDavid Howells /* 78607ca46eSDavid Howells * What to do with network protocol (NP) packets. 79607ca46eSDavid Howells */ 80607ca46eSDavid Howells enum NPmode { 81607ca46eSDavid Howells NPMODE_PASS, /* pass the packet through */ 82607ca46eSDavid Howells NPMODE_DROP, /* silently drop the packet */ 83607ca46eSDavid Howells NPMODE_ERROR, /* return an error */ 84607ca46eSDavid Howells NPMODE_QUEUE /* save it up for later. */ 85607ca46eSDavid Howells }; 86607ca46eSDavid Howells 87607ca46eSDavid Howells /* 88607ca46eSDavid Howells * Statistics for LQRP and pppstats 89607ca46eSDavid Howells */ 90607ca46eSDavid Howells struct pppstat { 91607ca46eSDavid Howells __u32 ppp_discards; /* # frames discarded */ 92607ca46eSDavid Howells 93607ca46eSDavid Howells __u32 ppp_ibytes; /* bytes received */ 94607ca46eSDavid Howells __u32 ppp_ioctects; /* bytes received not in error */ 95607ca46eSDavid Howells __u32 ppp_ipackets; /* packets received */ 96607ca46eSDavid Howells __u32 ppp_ierrors; /* receive errors */ 97607ca46eSDavid Howells __u32 ppp_ilqrs; /* # LQR frames received */ 98607ca46eSDavid Howells 99607ca46eSDavid Howells __u32 ppp_obytes; /* raw bytes sent */ 100607ca46eSDavid Howells __u32 ppp_ooctects; /* frame bytes sent */ 101607ca46eSDavid Howells __u32 ppp_opackets; /* packets sent */ 102607ca46eSDavid Howells __u32 ppp_oerrors; /* transmit errors */ 103607ca46eSDavid Howells __u32 ppp_olqrs; /* # LQR frames sent */ 104607ca46eSDavid Howells }; 105607ca46eSDavid Howells 106607ca46eSDavid Howells struct vjstat { 107607ca46eSDavid Howells __u32 vjs_packets; /* outbound packets */ 108607ca46eSDavid Howells __u32 vjs_compressed; /* outbound compressed packets */ 109607ca46eSDavid Howells __u32 vjs_searches; /* searches for connection state */ 110607ca46eSDavid Howells __u32 vjs_misses; /* times couldn't find conn. state */ 111607ca46eSDavid Howells __u32 vjs_uncompressedin; /* inbound uncompressed packets */ 112607ca46eSDavid Howells __u32 vjs_compressedin; /* inbound compressed packets */ 113607ca46eSDavid Howells __u32 vjs_errorin; /* inbound unknown type packets */ 114607ca46eSDavid Howells __u32 vjs_tossed; /* inbound packets tossed because of error */ 115607ca46eSDavid Howells }; 116607ca46eSDavid Howells 117607ca46eSDavid Howells struct compstat { 118607ca46eSDavid Howells __u32 unc_bytes; /* total uncompressed bytes */ 119607ca46eSDavid Howells __u32 unc_packets; /* total uncompressed packets */ 120607ca46eSDavid Howells __u32 comp_bytes; /* compressed bytes */ 121607ca46eSDavid Howells __u32 comp_packets; /* compressed packets */ 122607ca46eSDavid Howells __u32 inc_bytes; /* incompressible bytes */ 123607ca46eSDavid Howells __u32 inc_packets; /* incompressible packets */ 124607ca46eSDavid Howells 125607ca46eSDavid Howells /* the compression ratio is defined as in_count / bytes_out */ 126607ca46eSDavid Howells __u32 in_count; /* Bytes received */ 127607ca46eSDavid Howells __u32 bytes_out; /* Bytes transmitted */ 128607ca46eSDavid Howells 129607ca46eSDavid Howells double ratio; /* not computed in kernel. */ 130607ca46eSDavid Howells }; 131607ca46eSDavid Howells 132607ca46eSDavid Howells struct ppp_stats { 133607ca46eSDavid Howells struct pppstat p; /* basic PPP statistics */ 134607ca46eSDavid Howells struct vjstat vj; /* VJ header compression statistics */ 135607ca46eSDavid Howells }; 136607ca46eSDavid Howells 137607ca46eSDavid Howells struct ppp_comp_stats { 138607ca46eSDavid Howells struct compstat c; /* packet compression statistics */ 139607ca46eSDavid Howells struct compstat d; /* packet decompression statistics */ 140607ca46eSDavid Howells }; 141607ca46eSDavid Howells 142607ca46eSDavid Howells /* 143607ca46eSDavid Howells * The following structure records the time in seconds since 144607ca46eSDavid Howells * the last NP packet was sent or received. 14517c7e7f4SArnd Bergmann * 14617c7e7f4SArnd Bergmann * Linux implements both 32-bit and 64-bit time_t versions 14717c7e7f4SArnd Bergmann * for compatibility with user space that defines ppp_idle 14817c7e7f4SArnd Bergmann * based on the libc time_t. 149607ca46eSDavid Howells */ 150607ca46eSDavid Howells struct ppp_idle { 151*2a785996SArnd Bergmann __kernel_old_time_t xmit_idle; /* time since last NP packet sent */ 152*2a785996SArnd Bergmann __kernel_old_time_t recv_idle; /* time since last NP packet received */ 153607ca46eSDavid Howells }; 154607ca46eSDavid Howells 15517c7e7f4SArnd Bergmann struct ppp_idle32 { 15617c7e7f4SArnd Bergmann __s32 xmit_idle; /* time since last NP packet sent */ 15717c7e7f4SArnd Bergmann __s32 recv_idle; /* time since last NP packet received */ 15817c7e7f4SArnd Bergmann }; 15917c7e7f4SArnd Bergmann 16017c7e7f4SArnd Bergmann struct ppp_idle64 { 16117c7e7f4SArnd Bergmann __s64 xmit_idle; /* time since last NP packet sent */ 16217c7e7f4SArnd Bergmann __s64 recv_idle; /* time since last NP packet received */ 16317c7e7f4SArnd Bergmann }; 16417c7e7f4SArnd Bergmann 165607ca46eSDavid Howells #endif /* _UAPI_PPP_DEFS_H_ */ 166