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