14cf49a43SJulian Elischer /* 24cf49a43SJulian Elischer * ng_ppp.h 3c398230bSWarner Losh */ 4c398230bSWarner Losh 5c398230bSWarner Losh /*- 6a9b3dca5SArchie Cobbs * Copyright (c) 1996-2000 Whistle Communications, Inc. 74cf49a43SJulian Elischer * All rights reserved. 84cf49a43SJulian Elischer * 94cf49a43SJulian Elischer * Subject to the following obligations and disclaimer of warranty, use and 104cf49a43SJulian Elischer * redistribution of this software, in source or object code forms, with or 114cf49a43SJulian Elischer * without modifications are expressly permitted by Whistle Communications; 124cf49a43SJulian Elischer * provided, however, that: 134cf49a43SJulian Elischer * 1. Any and all reproductions of the source or object code must include the 144cf49a43SJulian Elischer * copyright notice above and the following disclaimer of warranties; and 154cf49a43SJulian Elischer * 2. No rights are granted, in any manner or form, to use Whistle 164cf49a43SJulian Elischer * Communications, Inc. trademarks, including the mark "WHISTLE 174cf49a43SJulian Elischer * COMMUNICATIONS" on advertising, endorsements, or otherwise except as 184cf49a43SJulian Elischer * such appears in the above copyright notice or in the software. 194cf49a43SJulian Elischer * 204cf49a43SJulian Elischer * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND 214cf49a43SJulian Elischer * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO 224cf49a43SJulian Elischer * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, 234cf49a43SJulian Elischer * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF 244cf49a43SJulian Elischer * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. 254cf49a43SJulian Elischer * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY 264cf49a43SJulian Elischer * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS 274cf49a43SJulian Elischer * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE. 284cf49a43SJulian Elischer * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES 294cf49a43SJulian Elischer * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING 304cf49a43SJulian Elischer * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 314cf49a43SJulian Elischer * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR 324cf49a43SJulian Elischer * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY 334cf49a43SJulian Elischer * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 344cf49a43SJulian Elischer * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 354cf49a43SJulian Elischer * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY 364cf49a43SJulian Elischer * OF SUCH DAMAGE. 374cf49a43SJulian Elischer * 386f16db81SArchie Cobbs * Author: Archie Cobbs <archie@freebsd.org> 394cf49a43SJulian Elischer * $Whistle: ng_ppp.h,v 1.8 1999/01/25 02:40:02 archie Exp $ 404cf49a43SJulian Elischer */ 414cf49a43SJulian Elischer 42e20480bfSRuslan Ermilov #ifndef _NETGRAPH_NG_PPP_H_ 43e20480bfSRuslan Ermilov #define _NETGRAPH_NG_PPP_H_ 444cf49a43SJulian Elischer 454cf49a43SJulian Elischer /* Node type name and magic cookie */ 464cf49a43SJulian Elischer #define NG_PPP_NODE_TYPE "ppp" 476f16db81SArchie Cobbs #define NGM_PPP_COOKIE 940897795 483949bee8SArchie Cobbs 49d6fe462aSAlexander Motin /* 64bit stats presence flag */ 50d6fe462aSAlexander Motin #define NG_PPP_STATS64 51d6fe462aSAlexander Motin 523949bee8SArchie Cobbs /* Maximum number of supported links */ 533949bee8SArchie Cobbs #define NG_PPP_MAX_LINKS 16 543949bee8SArchie Cobbs 553949bee8SArchie Cobbs /* Pseudo-link number representing the multi-link bundle */ 563949bee8SArchie Cobbs #define NG_PPP_BUNDLE_LINKNUM 0xffff 573949bee8SArchie Cobbs 583949bee8SArchie Cobbs /* Max allowable link latency (miliseconds) and bandwidth (bytes/second/10) */ 593949bee8SArchie Cobbs #define NG_PPP_MAX_LATENCY 1000 /* 1 second */ 603949bee8SArchie Cobbs #define NG_PPP_MAX_BANDWIDTH 125000 /* 10 Mbits / second */ 614cf49a43SJulian Elischer 624cf49a43SJulian Elischer /* Hook names */ 633949bee8SArchie Cobbs #define NG_PPP_HOOK_BYPASS "bypass" /* unknown protocols */ 643949bee8SArchie Cobbs #define NG_PPP_HOOK_COMPRESS "compress" /* outgoing compression */ 653949bee8SArchie Cobbs #define NG_PPP_HOOK_DECOMPRESS "decompress" /* incoming decompression */ 663949bee8SArchie Cobbs #define NG_PPP_HOOK_ENCRYPT "encrypt" /* outgoing encryption */ 673949bee8SArchie Cobbs #define NG_PPP_HOOK_DECRYPT "decrypt" /* incoming decryption */ 683949bee8SArchie Cobbs #define NG_PPP_HOOK_VJC_IP "vjc_ip" /* VJC raw IP */ 693949bee8SArchie Cobbs #define NG_PPP_HOOK_VJC_COMP "vjc_vjcomp" /* VJC compressed TCP */ 703949bee8SArchie Cobbs #define NG_PPP_HOOK_VJC_UNCOMP "vjc_vjuncomp" /* VJC uncompressed TCP */ 713949bee8SArchie Cobbs #define NG_PPP_HOOK_VJC_VJIP "vjc_vjip" /* VJC uncompressed IP */ 723949bee8SArchie Cobbs #define NG_PPP_HOOK_INET "inet" /* IP packet data */ 733949bee8SArchie Cobbs #define NG_PPP_HOOK_ATALK "atalk" /* AppleTalk packet data */ 743949bee8SArchie Cobbs #define NG_PPP_HOOK_IPX "ipx" /* IPX packet data */ 75a9b3dca5SArchie Cobbs #define NG_PPP_HOOK_IPV6 "ipv6" /* IPv6 packet data */ 763949bee8SArchie Cobbs 773949bee8SArchie Cobbs #define NG_PPP_HOOK_LINK_PREFIX "link" /* append decimal link number */ 784cf49a43SJulian Elischer 79ccb07cc3SGleb Smirnoff /* Compress hook operation modes */ 80ccb07cc3SGleb Smirnoff enum { 81ccb07cc3SGleb Smirnoff NG_PPP_COMPRESS_NONE = 0, /* compression disabled */ 82ccb07cc3SGleb Smirnoff NG_PPP_COMPRESS_SIMPLE, /* original operation mode */ 83ccb07cc3SGleb Smirnoff NG_PPP_COMPRESS_FULL, /* compressor returns proto */ 84ccb07cc3SGleb Smirnoff }; 85ccb07cc3SGleb Smirnoff 86ccb07cc3SGleb Smirnoff /* Decompress hook operation modes */ 87ccb07cc3SGleb Smirnoff enum { 88ccb07cc3SGleb Smirnoff NG_PPP_DECOMPRESS_NONE = 0, /* decompression disabled */ 89ccb07cc3SGleb Smirnoff NG_PPP_DECOMPRESS_SIMPLE, /* original operation mode */ 90ccb07cc3SGleb Smirnoff NG_PPP_DECOMPRESS_FULL, /* forward any packet to decompressor */ 91ccb07cc3SGleb Smirnoff }; 92ccb07cc3SGleb Smirnoff 934cf49a43SJulian Elischer /* Netgraph commands */ 944cf49a43SJulian Elischer enum { 95a9b3dca5SArchie Cobbs NGM_PPP_SET_CONFIG = 1, /* takes struct ng_ppp_node_conf */ 96a9b3dca5SArchie Cobbs NGM_PPP_GET_CONFIG, /* returns ng_ppp_node_conf */ 976f16db81SArchie Cobbs NGM_PPP_GET_MP_STATE, /* returns ng_ppp_mp_state */ 983949bee8SArchie Cobbs NGM_PPP_GET_LINK_STATS, /* takes link #, returns stats struct */ 993949bee8SArchie Cobbs NGM_PPP_CLR_LINK_STATS, /* takes link #, clears link stats */ 100e149c4e2SArchie Cobbs NGM_PPP_GETCLR_LINK_STATS, /* takes link #, returns & clrs stats */ 101d6fe462aSAlexander Motin NGM_PPP_GET_LINK_STATS64, /* takes link #, returns stats64 struct */ 102d6fe462aSAlexander Motin NGM_PPP_GETCLR_LINK_STATS64, /* takes link #, returns stats64 & clrs */ 1034cf49a43SJulian Elischer }; 1044cf49a43SJulian Elischer 1056f16db81SArchie Cobbs /* Multi-link sequence number state (for debugging) */ 1066f16db81SArchie Cobbs struct ng_ppp_mp_state { 1076f16db81SArchie Cobbs int32_t rseq[NG_PPP_MAX_LINKS]; /* highest rec'd MP seq # */ 1086f16db81SArchie Cobbs int32_t mseq; /* min rseq[i] */ 1096f16db81SArchie Cobbs int32_t xseq; /* next xmit MP seq # */ 1106f16db81SArchie Cobbs }; 1116f16db81SArchie Cobbs 1126f16db81SArchie Cobbs /* Keep this in sync with the above structure definition */ 1136f16db81SArchie Cobbs #define NG_PPP_MP_STATE_TYPE_INFO(atype) { \ 1146f16db81SArchie Cobbs { "rseq", (atype) }, \ 1156f16db81SArchie Cobbs { "mseq", &ng_parse_hint32_type }, \ 1166f16db81SArchie Cobbs { "xseq", &ng_parse_hint32_type }, \ 117f0184ff8SArchie Cobbs { NULL } \ 1186f16db81SArchie Cobbs } 1196f16db81SArchie Cobbs 1203949bee8SArchie Cobbs /* Per-link config structure */ 121a9b3dca5SArchie Cobbs struct ng_ppp_link_conf { 1223949bee8SArchie Cobbs u_char enableLink; /* enable this link */ 1233949bee8SArchie Cobbs u_char enableProtoComp;/* enable protocol field compression */ 124d690a6e7SArchie Cobbs u_char enableACFComp; /* enable addr/ctrl field compression */ 1253949bee8SArchie Cobbs u_int16_t mru; /* peer MRU */ 1263949bee8SArchie Cobbs u_int32_t latency; /* link latency (in milliseconds) */ 12725b67768SArchie Cobbs u_int32_t bandwidth; /* link bandwidth (in bytes/sec/10) */ 1284cf49a43SJulian Elischer }; 1294cf49a43SJulian Elischer 130f8307e12SArchie Cobbs /* Keep this in sync with the above structure definition */ 131f8307e12SArchie Cobbs #define NG_PPP_LINK_TYPE_INFO { \ 13257b57be3SArchie Cobbs { "enableLink", &ng_parse_uint8_type }, \ 13357b57be3SArchie Cobbs { "enableProtoComp", &ng_parse_uint8_type }, \ 13457b57be3SArchie Cobbs { "enableACFComp", &ng_parse_uint8_type }, \ 13557b57be3SArchie Cobbs { "mru", &ng_parse_uint16_type }, \ 13657b57be3SArchie Cobbs { "latency", &ng_parse_uint32_type }, \ 13757b57be3SArchie Cobbs { "bandwidth", &ng_parse_uint32_type }, \ 138f0184ff8SArchie Cobbs { NULL } \ 139f8307e12SArchie Cobbs } 140f8307e12SArchie Cobbs 141a9b3dca5SArchie Cobbs /* Bundle config structure */ 142a9b3dca5SArchie Cobbs struct ng_ppp_bund_conf { 1433949bee8SArchie Cobbs u_int16_t mrru; /* multilink peer MRRU */ 1443949bee8SArchie Cobbs u_char enableMultilink; /* enable multilink */ 1453949bee8SArchie Cobbs u_char recvShortSeq; /* recv multilink short seq # */ 1463949bee8SArchie Cobbs u_char xmitShortSeq; /* xmit multilink short seq # */ 1473949bee8SArchie Cobbs u_char enableRoundRobin; /* xmit whole packets */ 1483949bee8SArchie Cobbs u_char enableIP; /* enable IP data flow */ 149a9b3dca5SArchie Cobbs u_char enableIPv6; /* enable IPv6 data flow */ 1503949bee8SArchie Cobbs u_char enableAtalk; /* enable AppleTalk data flow */ 1513949bee8SArchie Cobbs u_char enableIPX; /* enable IPX data flow */ 1523949bee8SArchie Cobbs u_char enableCompression; /* enable PPP compression */ 1533949bee8SArchie Cobbs u_char enableDecompression; /* enable PPP decompression */ 1543949bee8SArchie Cobbs u_char enableEncryption; /* enable PPP encryption */ 1553949bee8SArchie Cobbs u_char enableDecryption; /* enable PPP decryption */ 1563949bee8SArchie Cobbs u_char enableVJCompression; /* enable VJ compression */ 1573949bee8SArchie Cobbs u_char enableVJDecompression; /* enable VJ decompression */ 1583949bee8SArchie Cobbs }; 1593949bee8SArchie Cobbs 160f8307e12SArchie Cobbs /* Keep this in sync with the above structure definition */ 161a9b3dca5SArchie Cobbs #define NG_PPP_BUND_TYPE_INFO { \ 16257b57be3SArchie Cobbs { "mrru", &ng_parse_uint16_type }, \ 16357b57be3SArchie Cobbs { "enableMultilink", &ng_parse_uint8_type }, \ 16457b57be3SArchie Cobbs { "recvShortSeq", &ng_parse_uint8_type }, \ 16557b57be3SArchie Cobbs { "xmitShortSeq", &ng_parse_uint8_type }, \ 16657b57be3SArchie Cobbs { "enableRoundRobin", &ng_parse_uint8_type }, \ 16757b57be3SArchie Cobbs { "enableIP", &ng_parse_uint8_type }, \ 16857b57be3SArchie Cobbs { "enableIPv6", &ng_parse_uint8_type }, \ 16957b57be3SArchie Cobbs { "enableAtalk", &ng_parse_uint8_type }, \ 17057b57be3SArchie Cobbs { "enableIPX", &ng_parse_uint8_type }, \ 17157b57be3SArchie Cobbs { "enableCompression", &ng_parse_uint8_type }, \ 17257b57be3SArchie Cobbs { "enableDecompression", &ng_parse_uint8_type }, \ 17357b57be3SArchie Cobbs { "enableEncryption", &ng_parse_uint8_type }, \ 17457b57be3SArchie Cobbs { "enableDecryption", &ng_parse_uint8_type }, \ 17557b57be3SArchie Cobbs { "enableVJCompression", &ng_parse_uint8_type }, \ 17657b57be3SArchie Cobbs { "enableVJDecompression", &ng_parse_uint8_type }, \ 177a9b3dca5SArchie Cobbs { NULL } \ 178a9b3dca5SArchie Cobbs } 179a9b3dca5SArchie Cobbs 180a9b3dca5SArchie Cobbs /* Total node config structure */ 181a9b3dca5SArchie Cobbs struct ng_ppp_node_conf { 182a9b3dca5SArchie Cobbs struct ng_ppp_bund_conf bund; 183a9b3dca5SArchie Cobbs struct ng_ppp_link_conf links[NG_PPP_MAX_LINKS]; 184a9b3dca5SArchie Cobbs }; 185a9b3dca5SArchie Cobbs 186a9b3dca5SArchie Cobbs /* Keep this in sync with the above structure definition */ 187a9b3dca5SArchie Cobbs #define NG_PPP_CONFIG_TYPE_INFO(bctype, arytype) { \ 188a9b3dca5SArchie Cobbs { "bund", (bctype) }, \ 189f8307e12SArchie Cobbs { "links", (arytype) }, \ 190a9b3dca5SArchie Cobbs { NULL } \ 191f8307e12SArchie Cobbs } 192f8307e12SArchie Cobbs 1933949bee8SArchie Cobbs /* Statistics struct for a link (or the bundle if NG_PPP_BUNDLE_LINKNUM) */ 1943949bee8SArchie Cobbs struct ng_ppp_link_stat { 1953949bee8SArchie Cobbs u_int32_t xmitFrames; /* xmit frames on link */ 1963949bee8SArchie Cobbs u_int32_t xmitOctets; /* xmit octets on link */ 1973949bee8SArchie Cobbs u_int32_t recvFrames; /* recv frames on link */ 1983949bee8SArchie Cobbs u_int32_t recvOctets; /* recv octets on link */ 1993949bee8SArchie Cobbs u_int32_t badProtos; /* frames rec'd with bogus protocol */ 200a9b3dca5SArchie Cobbs u_int32_t runts; /* Too short MP fragments */ 2013949bee8SArchie Cobbs u_int32_t dupFragments; /* MP frames with duplicate seq # */ 202a9b3dca5SArchie Cobbs u_int32_t dropFragments; /* MP fragments we had to drop */ 2033949bee8SArchie Cobbs }; 2044cf49a43SJulian Elischer 205f8307e12SArchie Cobbs /* Keep this in sync with the above structure definition */ 206f8307e12SArchie Cobbs #define NG_PPP_STATS_TYPE_INFO { \ 20757b57be3SArchie Cobbs { "xmitFrames", &ng_parse_uint32_type }, \ 20857b57be3SArchie Cobbs { "xmitOctets", &ng_parse_uint32_type }, \ 20957b57be3SArchie Cobbs { "recvFrames", &ng_parse_uint32_type }, \ 21057b57be3SArchie Cobbs { "recvOctets", &ng_parse_uint32_type }, \ 21157b57be3SArchie Cobbs { "badProtos", &ng_parse_uint32_type }, \ 21257b57be3SArchie Cobbs { "runts", &ng_parse_uint32_type }, \ 21357b57be3SArchie Cobbs { "dupFragments", &ng_parse_uint32_type }, \ 21457b57be3SArchie Cobbs { "dropFragments", &ng_parse_uint32_type }, \ 215a9b3dca5SArchie Cobbs { NULL } \ 216f8307e12SArchie Cobbs } 217f8307e12SArchie Cobbs 218d6fe462aSAlexander Motin /* Statistics struct for a link (or the bundle if NG_PPP_BUNDLE_LINKNUM) */ 219d6fe462aSAlexander Motin struct ng_ppp_link_stat64 { 220d6fe462aSAlexander Motin u_int64_t xmitFrames; /* xmit frames on link */ 221d6fe462aSAlexander Motin u_int64_t xmitOctets; /* xmit octets on link */ 222d6fe462aSAlexander Motin u_int64_t recvFrames; /* recv frames on link */ 223d6fe462aSAlexander Motin u_int64_t recvOctets; /* recv octets on link */ 224d6fe462aSAlexander Motin u_int64_t badProtos; /* frames rec'd with bogus protocol */ 225d6fe462aSAlexander Motin u_int64_t runts; /* Too short MP fragments */ 226d6fe462aSAlexander Motin u_int64_t dupFragments; /* MP frames with duplicate seq # */ 227d6fe462aSAlexander Motin u_int64_t dropFragments; /* MP fragments we had to drop */ 228d6fe462aSAlexander Motin }; 229d6fe462aSAlexander Motin 230d6fe462aSAlexander Motin /* Keep this in sync with the above structure definition */ 231d6fe462aSAlexander Motin #define NG_PPP_STATS64_TYPE_INFO { \ 232d6fe462aSAlexander Motin { "xmitFrames", &ng_parse_uint64_type }, \ 233d6fe462aSAlexander Motin { "xmitOctets", &ng_parse_uint64_type }, \ 234d6fe462aSAlexander Motin { "recvFrames", &ng_parse_uint64_type }, \ 235d6fe462aSAlexander Motin { "recvOctets", &ng_parse_uint64_type }, \ 236d6fe462aSAlexander Motin { "badProtos", &ng_parse_uint64_type }, \ 237d6fe462aSAlexander Motin { "runts", &ng_parse_uint64_type }, \ 238d6fe462aSAlexander Motin { "dupFragments", &ng_parse_uint64_type }, \ 239d6fe462aSAlexander Motin { "dropFragments", &ng_parse_uint64_type }, \ 240d6fe462aSAlexander Motin { NULL } \ 241d6fe462aSAlexander Motin } 242d6fe462aSAlexander Motin 243e20480bfSRuslan Ermilov #endif /* _NETGRAPH_NG_PPP_H_ */ 244