Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 /*
0003  * ppp_defs.h - PPP definitions.
0004  *
0005  * Copyright 1994-2000 Paul Mackerras.
0006  *
0007  *  This program is free software; you can redistribute it and/or
0008  *  modify it under the terms of the GNU General Public License
0009  *  version 2 as published by the Free Software Foundation.
0010  */
0011 #include <linux/types.h>
0012 
0013 #ifndef _UAPI_PPP_DEFS_H_
0014 #define _UAPI_PPP_DEFS_H_
0015 
0016 /*
0017  * The basic PPP frame.
0018  */
0019 #define PPP_HDRLEN  4   /* octets for standard ppp header */
0020 #define PPP_FCSLEN  2   /* octets for FCS */
0021 #define PPP_MRU     1500    /* default MRU = max length of info field */
0022 
0023 #define PPP_ADDRESS(p)  (((__u8 *)(p))[0])
0024 #define PPP_CONTROL(p)  (((__u8 *)(p))[1])
0025 #define PPP_PROTOCOL(p) ((((__u8 *)(p))[2] << 8) + ((__u8 *)(p))[3])
0026 
0027 /*
0028  * Significant octet values.
0029  */
0030 #define PPP_ALLSTATIONS 0xff    /* All-Stations broadcast address */
0031 #define PPP_UI      0x03    /* Unnumbered Information */
0032 #define PPP_FLAG    0x7e    /* Flag Sequence */
0033 #define PPP_ESCAPE  0x7d    /* Asynchronous Control Escape */
0034 #define PPP_TRANS   0x20    /* Asynchronous transparency modifier */
0035 
0036 /*
0037  * Protocol field values.
0038  */
0039 #define PPP_IP      0x21    /* Internet Protocol */
0040 #define PPP_AT      0x29    /* AppleTalk Protocol */
0041 #define PPP_IPX     0x2b    /* IPX protocol */
0042 #define PPP_VJC_COMP    0x2d    /* VJ compressed TCP */
0043 #define PPP_VJC_UNCOMP  0x2f    /* VJ uncompressed TCP */
0044 #define PPP_MP      0x3d    /* Multilink protocol */
0045 #define PPP_IPV6    0x57    /* Internet Protocol Version 6 */
0046 #define PPP_COMPFRAG    0xfb    /* fragment compressed below bundle */
0047 #define PPP_COMP    0xfd    /* compressed packet */
0048 #define PPP_MPLS_UC 0x0281  /* Multi Protocol Label Switching - Unicast */
0049 #define PPP_MPLS_MC 0x0283  /* Multi Protocol Label Switching - Multicast */
0050 #define PPP_IPCP    0x8021  /* IP Control Protocol */
0051 #define PPP_ATCP    0x8029  /* AppleTalk Control Protocol */
0052 #define PPP_IPXCP   0x802b  /* IPX Control Protocol */
0053 #define PPP_IPV6CP  0x8057  /* IPv6 Control Protocol */
0054 #define PPP_CCPFRAG 0x80fb  /* CCP at link level (below MP bundle) */
0055 #define PPP_CCP     0x80fd  /* Compression Control Protocol */
0056 #define PPP_MPLSCP  0x80fd  /* MPLS Control Protocol */
0057 #define PPP_LCP     0xc021  /* Link Control Protocol */
0058 #define PPP_PAP     0xc023  /* Password Authentication Protocol */
0059 #define PPP_LQR     0xc025  /* Link Quality Report protocol */
0060 #define PPP_CHAP    0xc223  /* Cryptographic Handshake Auth. Protocol */
0061 #define PPP_CBCP    0xc029  /* Callback Control Protocol */
0062 
0063 /*
0064  * Values for FCS calculations.
0065  */
0066 
0067 #define PPP_INITFCS 0xffff  /* Initial FCS value */
0068 #define PPP_GOODFCS 0xf0b8  /* Good final FCS value */
0069 
0070 
0071 /*
0072  * Extended asyncmap - allows any character to be escaped.
0073  */
0074 
0075 typedef __u32       ext_accm[8];
0076 
0077 /*
0078  * What to do with network protocol (NP) packets.
0079  */
0080 enum NPmode {
0081     NPMODE_PASS,        /* pass the packet through */
0082     NPMODE_DROP,        /* silently drop the packet */
0083     NPMODE_ERROR,       /* return an error */
0084     NPMODE_QUEUE        /* save it up for later. */
0085 };
0086 
0087 /*
0088  * Statistics for LQRP and pppstats
0089  */
0090 struct pppstat  {
0091     __u32   ppp_discards;   /* # frames discarded */
0092 
0093     __u32   ppp_ibytes; /* bytes received */
0094     __u32   ppp_ioctects;   /* bytes received not in error */
0095     __u32   ppp_ipackets;   /* packets received */
0096     __u32   ppp_ierrors;    /* receive errors */
0097     __u32   ppp_ilqrs;  /* # LQR frames received */
0098 
0099     __u32   ppp_obytes; /* raw bytes sent */
0100     __u32   ppp_ooctects;   /* frame bytes sent */
0101     __u32   ppp_opackets;   /* packets sent */
0102     __u32   ppp_oerrors;    /* transmit errors */ 
0103     __u32   ppp_olqrs;  /* # LQR frames sent */
0104 };
0105 
0106 struct vjstat {
0107     __u32   vjs_packets;    /* outbound packets */
0108     __u32   vjs_compressed; /* outbound compressed packets */
0109     __u32   vjs_searches;   /* searches for connection state */
0110     __u32   vjs_misses; /* times couldn't find conn. state */
0111     __u32   vjs_uncompressedin; /* inbound uncompressed packets */
0112     __u32   vjs_compressedin;   /* inbound compressed packets */
0113     __u32   vjs_errorin;    /* inbound unknown type packets */
0114     __u32   vjs_tossed; /* inbound packets tossed because of error */
0115 };
0116 
0117 struct compstat {
0118     __u32   unc_bytes;  /* total uncompressed bytes */
0119     __u32   unc_packets;    /* total uncompressed packets */
0120     __u32   comp_bytes; /* compressed bytes */
0121     __u32   comp_packets;   /* compressed packets */
0122     __u32   inc_bytes;  /* incompressible bytes */
0123     __u32   inc_packets;    /* incompressible packets */
0124 
0125     /* the compression ratio is defined as in_count / bytes_out */
0126     __u32       in_count;   /* Bytes received */
0127     __u32       bytes_out;  /* Bytes transmitted */
0128 
0129     double  ratio;      /* not computed in kernel. */
0130 };
0131 
0132 struct ppp_stats {
0133     struct pppstat  p;  /* basic PPP statistics */
0134     struct vjstat   vj; /* VJ header compression statistics */
0135 };
0136 
0137 struct ppp_comp_stats {
0138     struct compstat c;  /* packet compression statistics */
0139     struct compstat d;  /* packet decompression statistics */
0140 };
0141 
0142 /*
0143  * The following structure records the time in seconds since
0144  * the last NP packet was sent or received.
0145  *
0146  * Linux implements both 32-bit and 64-bit time_t versions
0147  * for compatibility with user space that defines ppp_idle
0148  * based on the libc time_t.
0149  */
0150 struct ppp_idle {
0151     __kernel_old_time_t xmit_idle;  /* time since last NP packet sent */
0152     __kernel_old_time_t recv_idle;  /* time since last NP packet received */
0153 };
0154 
0155 struct ppp_idle32 {
0156     __s32 xmit_idle;        /* time since last NP packet sent */
0157     __s32 recv_idle;        /* time since last NP packet received */
0158 };
0159 
0160 struct ppp_idle64 {
0161     __s64 xmit_idle;        /* time since last NP packet sent */
0162     __s64 recv_idle;        /* time since last NP packet received */
0163 };
0164 
0165 #endif /* _UAPI_PPP_DEFS_H_ */