1*86d7f5d3SJohn Marino 2*86d7f5d3SJohn Marino /* 3*86d7f5d3SJohn Marino * ng_ppp.h 4*86d7f5d3SJohn Marino * 5*86d7f5d3SJohn Marino * Copyright (c) 1996-2000 Whistle Communications, Inc. 6*86d7f5d3SJohn Marino * All rights reserved. 7*86d7f5d3SJohn Marino * 8*86d7f5d3SJohn Marino * Subject to the following obligations and disclaimer of warranty, use and 9*86d7f5d3SJohn Marino * redistribution of this software, in source or object code forms, with or 10*86d7f5d3SJohn Marino * without modifications are expressly permitted by Whistle Communications; 11*86d7f5d3SJohn Marino * provided, however, that: 12*86d7f5d3SJohn Marino * 1. Any and all reproductions of the source or object code must include the 13*86d7f5d3SJohn Marino * copyright notice above and the following disclaimer of warranties; and 14*86d7f5d3SJohn Marino * 2. No rights are granted, in any manner or form, to use Whistle 15*86d7f5d3SJohn Marino * Communications, Inc. trademarks, including the mark "WHISTLE 16*86d7f5d3SJohn Marino * COMMUNICATIONS" on advertising, endorsements, or otherwise except as 17*86d7f5d3SJohn Marino * such appears in the above copyright notice or in the software. 18*86d7f5d3SJohn Marino * 19*86d7f5d3SJohn Marino * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND 20*86d7f5d3SJohn Marino * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO 21*86d7f5d3SJohn Marino * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, 22*86d7f5d3SJohn Marino * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF 23*86d7f5d3SJohn Marino * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. 24*86d7f5d3SJohn Marino * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY 25*86d7f5d3SJohn Marino * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS 26*86d7f5d3SJohn Marino * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE. 27*86d7f5d3SJohn Marino * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES 28*86d7f5d3SJohn Marino * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING 29*86d7f5d3SJohn Marino * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 30*86d7f5d3SJohn Marino * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR 31*86d7f5d3SJohn Marino * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY 32*86d7f5d3SJohn Marino * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33*86d7f5d3SJohn Marino * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 34*86d7f5d3SJohn Marino * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY 35*86d7f5d3SJohn Marino * OF SUCH DAMAGE. 36*86d7f5d3SJohn Marino * 37*86d7f5d3SJohn Marino * Author: Archie Cobbs <archie@freebsd.org> 38*86d7f5d3SJohn Marino * 39*86d7f5d3SJohn Marino * $FreeBSD: src/sys/netgraph/ng_ppp.h,v 1.5.2.4 2002/07/02 23:44:03 archie Exp $ 40*86d7f5d3SJohn Marino * $DragonFly: src/sys/netgraph/ppp/ng_ppp.h,v 1.2 2003/06/17 04:28:51 dillon Exp $ 41*86d7f5d3SJohn Marino * $Whistle: ng_ppp.h,v 1.8 1999/01/25 02:40:02 archie Exp $ 42*86d7f5d3SJohn Marino */ 43*86d7f5d3SJohn Marino 44*86d7f5d3SJohn Marino #ifndef _NETGRAPH_PPP_H_ 45*86d7f5d3SJohn Marino #define _NETGRAPH_PPP_H_ 46*86d7f5d3SJohn Marino 47*86d7f5d3SJohn Marino /* Node type name and magic cookie */ 48*86d7f5d3SJohn Marino #define NG_PPP_NODE_TYPE "ppp" 49*86d7f5d3SJohn Marino #define NGM_PPP_COOKIE 940897795 50*86d7f5d3SJohn Marino 51*86d7f5d3SJohn Marino /* Maximum number of supported links */ 52*86d7f5d3SJohn Marino #define NG_PPP_MAX_LINKS 16 53*86d7f5d3SJohn Marino 54*86d7f5d3SJohn Marino /* Pseudo-link number representing the multi-link bundle */ 55*86d7f5d3SJohn Marino #define NG_PPP_BUNDLE_LINKNUM 0xffff 56*86d7f5d3SJohn Marino 57*86d7f5d3SJohn Marino /* Max allowable link latency (miliseconds) and bandwidth (bytes/second/10) */ 58*86d7f5d3SJohn Marino #define NG_PPP_MAX_LATENCY 1000 /* 1 second */ 59*86d7f5d3SJohn Marino #define NG_PPP_MAX_BANDWIDTH 125000 /* 10 Mbits / second */ 60*86d7f5d3SJohn Marino 61*86d7f5d3SJohn Marino /* Hook names */ 62*86d7f5d3SJohn Marino #define NG_PPP_HOOK_BYPASS "bypass" /* unknown protocols */ 63*86d7f5d3SJohn Marino #define NG_PPP_HOOK_COMPRESS "compress" /* outgoing compression */ 64*86d7f5d3SJohn Marino #define NG_PPP_HOOK_DECOMPRESS "decompress" /* incoming decompression */ 65*86d7f5d3SJohn Marino #define NG_PPP_HOOK_ENCRYPT "encrypt" /* outgoing encryption */ 66*86d7f5d3SJohn Marino #define NG_PPP_HOOK_DECRYPT "decrypt" /* incoming decryption */ 67*86d7f5d3SJohn Marino #define NG_PPP_HOOK_VJC_IP "vjc_ip" /* VJC raw IP */ 68*86d7f5d3SJohn Marino #define NG_PPP_HOOK_VJC_COMP "vjc_vjcomp" /* VJC compressed TCP */ 69*86d7f5d3SJohn Marino #define NG_PPP_HOOK_VJC_UNCOMP "vjc_vjuncomp" /* VJC uncompressed TCP */ 70*86d7f5d3SJohn Marino #define NG_PPP_HOOK_VJC_VJIP "vjc_vjip" /* VJC uncompressed IP */ 71*86d7f5d3SJohn Marino #define NG_PPP_HOOK_INET "inet" /* IP packet data */ 72*86d7f5d3SJohn Marino #define NG_PPP_HOOK_ATALK "atalk" /* AppleTalk packet data */ 73*86d7f5d3SJohn Marino #define NG_PPP_HOOK_IPX "ipx" /* IPX packet data */ 74*86d7f5d3SJohn Marino #define NG_PPP_HOOK_IPV6 "ipv6" /* IPv6 packet data */ 75*86d7f5d3SJohn Marino 76*86d7f5d3SJohn Marino #define NG_PPP_HOOK_LINK_PREFIX "link" /* append decimal link number */ 77*86d7f5d3SJohn Marino 78*86d7f5d3SJohn Marino /* Netgraph commands */ 79*86d7f5d3SJohn Marino enum { 80*86d7f5d3SJohn Marino NGM_PPP_SET_CONFIG = 1, /* takes struct ng_ppp_node_conf */ 81*86d7f5d3SJohn Marino NGM_PPP_GET_CONFIG, /* returns ng_ppp_node_conf */ 82*86d7f5d3SJohn Marino NGM_PPP_GET_MP_STATE, /* returns ng_ppp_mp_state */ 83*86d7f5d3SJohn Marino NGM_PPP_GET_LINK_STATS, /* takes link #, returns stats struct */ 84*86d7f5d3SJohn Marino NGM_PPP_CLR_LINK_STATS, /* takes link #, clears link stats */ 85*86d7f5d3SJohn Marino NGM_PPP_GETCLR_LINK_STATS, /* takes link #, returns & clrs stats */ 86*86d7f5d3SJohn Marino }; 87*86d7f5d3SJohn Marino 88*86d7f5d3SJohn Marino /* Multi-link sequence number state (for debugging) */ 89*86d7f5d3SJohn Marino struct ng_ppp_mp_state { 90*86d7f5d3SJohn Marino int32_t rseq[NG_PPP_MAX_LINKS]; /* highest rec'd MP seq # */ 91*86d7f5d3SJohn Marino int32_t mseq; /* min rseq[i] */ 92*86d7f5d3SJohn Marino int32_t xseq; /* next xmit MP seq # */ 93*86d7f5d3SJohn Marino }; 94*86d7f5d3SJohn Marino 95*86d7f5d3SJohn Marino /* Keep this in sync with the above structure definition */ 96*86d7f5d3SJohn Marino #define NG_PPP_MP_STATE_TYPE_INFO(atype) { \ 97*86d7f5d3SJohn Marino { "rseq", (atype) }, \ 98*86d7f5d3SJohn Marino { "mseq", &ng_parse_hint32_type }, \ 99*86d7f5d3SJohn Marino { "xseq", &ng_parse_hint32_type }, \ 100*86d7f5d3SJohn Marino { NULL } \ 101*86d7f5d3SJohn Marino } 102*86d7f5d3SJohn Marino 103*86d7f5d3SJohn Marino /* Per-link config structure */ 104*86d7f5d3SJohn Marino struct ng_ppp_link_conf { 105*86d7f5d3SJohn Marino u_char enableLink; /* enable this link */ 106*86d7f5d3SJohn Marino u_char enableProtoComp;/* enable protocol field compression */ 107*86d7f5d3SJohn Marino u_char enableACFComp; /* enable addr/ctrl field compression */ 108*86d7f5d3SJohn Marino u_int16_t mru; /* peer MRU */ 109*86d7f5d3SJohn Marino u_int32_t latency; /* link latency (in milliseconds) */ 110*86d7f5d3SJohn Marino u_int32_t bandwidth; /* link bandwidth (in bytes/second) */ 111*86d7f5d3SJohn Marino }; 112*86d7f5d3SJohn Marino 113*86d7f5d3SJohn Marino /* Keep this in sync with the above structure definition */ 114*86d7f5d3SJohn Marino #define NG_PPP_LINK_TYPE_INFO { \ 115*86d7f5d3SJohn Marino { "enableLink", &ng_parse_uint8_type }, \ 116*86d7f5d3SJohn Marino { "enableProtoComp", &ng_parse_uint8_type }, \ 117*86d7f5d3SJohn Marino { "enableACFComp", &ng_parse_uint8_type }, \ 118*86d7f5d3SJohn Marino { "mru", &ng_parse_uint16_type }, \ 119*86d7f5d3SJohn Marino { "latency", &ng_parse_uint32_type }, \ 120*86d7f5d3SJohn Marino { "bandwidth", &ng_parse_uint32_type }, \ 121*86d7f5d3SJohn Marino { NULL } \ 122*86d7f5d3SJohn Marino } 123*86d7f5d3SJohn Marino 124*86d7f5d3SJohn Marino /* Bundle config structure */ 125*86d7f5d3SJohn Marino struct ng_ppp_bund_conf { 126*86d7f5d3SJohn Marino u_int16_t mrru; /* multilink peer MRRU */ 127*86d7f5d3SJohn Marino u_char enableMultilink; /* enable multilink */ 128*86d7f5d3SJohn Marino u_char recvShortSeq; /* recv multilink short seq # */ 129*86d7f5d3SJohn Marino u_char xmitShortSeq; /* xmit multilink short seq # */ 130*86d7f5d3SJohn Marino u_char enableRoundRobin; /* xmit whole packets */ 131*86d7f5d3SJohn Marino u_char enableIP; /* enable IP data flow */ 132*86d7f5d3SJohn Marino u_char enableIPv6; /* enable IPv6 data flow */ 133*86d7f5d3SJohn Marino u_char enableAtalk; /* enable AppleTalk data flow */ 134*86d7f5d3SJohn Marino u_char enableIPX; /* enable IPX data flow */ 135*86d7f5d3SJohn Marino u_char enableCompression; /* enable PPP compression */ 136*86d7f5d3SJohn Marino u_char enableDecompression; /* enable PPP decompression */ 137*86d7f5d3SJohn Marino u_char enableEncryption; /* enable PPP encryption */ 138*86d7f5d3SJohn Marino u_char enableDecryption; /* enable PPP decryption */ 139*86d7f5d3SJohn Marino u_char enableVJCompression; /* enable VJ compression */ 140*86d7f5d3SJohn Marino u_char enableVJDecompression; /* enable VJ decompression */ 141*86d7f5d3SJohn Marino }; 142*86d7f5d3SJohn Marino 143*86d7f5d3SJohn Marino /* Keep this in sync with the above structure definition */ 144*86d7f5d3SJohn Marino #define NG_PPP_BUND_TYPE_INFO { \ 145*86d7f5d3SJohn Marino { "mrru", &ng_parse_uint16_type }, \ 146*86d7f5d3SJohn Marino { "enableMultilink", &ng_parse_uint8_type }, \ 147*86d7f5d3SJohn Marino { "recvShortSeq", &ng_parse_uint8_type }, \ 148*86d7f5d3SJohn Marino { "xmitShortSeq", &ng_parse_uint8_type }, \ 149*86d7f5d3SJohn Marino { "enableRoundRobin", &ng_parse_uint8_type }, \ 150*86d7f5d3SJohn Marino { "enableIP", &ng_parse_uint8_type }, \ 151*86d7f5d3SJohn Marino { "enableIPv6", &ng_parse_uint8_type }, \ 152*86d7f5d3SJohn Marino { "enableAtalk", &ng_parse_uint8_type }, \ 153*86d7f5d3SJohn Marino { "enableIPX", &ng_parse_uint8_type }, \ 154*86d7f5d3SJohn Marino { "enableCompression", &ng_parse_uint8_type }, \ 155*86d7f5d3SJohn Marino { "enableDecompression", &ng_parse_uint8_type }, \ 156*86d7f5d3SJohn Marino { "enableEncryption", &ng_parse_uint8_type }, \ 157*86d7f5d3SJohn Marino { "enableDecryption", &ng_parse_uint8_type }, \ 158*86d7f5d3SJohn Marino { "enableVJCompression", &ng_parse_uint8_type }, \ 159*86d7f5d3SJohn Marino { "enableVJDecompression", &ng_parse_uint8_type }, \ 160*86d7f5d3SJohn Marino { NULL } \ 161*86d7f5d3SJohn Marino } 162*86d7f5d3SJohn Marino 163*86d7f5d3SJohn Marino /* Total node config structure */ 164*86d7f5d3SJohn Marino struct ng_ppp_node_conf { 165*86d7f5d3SJohn Marino struct ng_ppp_bund_conf bund; 166*86d7f5d3SJohn Marino struct ng_ppp_link_conf links[NG_PPP_MAX_LINKS]; 167*86d7f5d3SJohn Marino }; 168*86d7f5d3SJohn Marino 169*86d7f5d3SJohn Marino /* Keep this in sync with the above structure definition */ 170*86d7f5d3SJohn Marino #define NG_PPP_CONFIG_TYPE_INFO(bctype, arytype) { \ 171*86d7f5d3SJohn Marino { "bund", (bctype) }, \ 172*86d7f5d3SJohn Marino { "links", (arytype) }, \ 173*86d7f5d3SJohn Marino { NULL } \ 174*86d7f5d3SJohn Marino } 175*86d7f5d3SJohn Marino 176*86d7f5d3SJohn Marino /* Statistics struct for a link (or the bundle if NG_PPP_BUNDLE_LINKNUM) */ 177*86d7f5d3SJohn Marino struct ng_ppp_link_stat { 178*86d7f5d3SJohn Marino u_int32_t xmitFrames; /* xmit frames on link */ 179*86d7f5d3SJohn Marino u_int32_t xmitOctets; /* xmit octets on link */ 180*86d7f5d3SJohn Marino u_int32_t recvFrames; /* recv frames on link */ 181*86d7f5d3SJohn Marino u_int32_t recvOctets; /* recv octets on link */ 182*86d7f5d3SJohn Marino u_int32_t badProtos; /* frames rec'd with bogus protocol */ 183*86d7f5d3SJohn Marino u_int32_t runts; /* Too short MP fragments */ 184*86d7f5d3SJohn Marino u_int32_t dupFragments; /* MP frames with duplicate seq # */ 185*86d7f5d3SJohn Marino u_int32_t dropFragments; /* MP fragments we had to drop */ 186*86d7f5d3SJohn Marino }; 187*86d7f5d3SJohn Marino 188*86d7f5d3SJohn Marino /* Keep this in sync with the above structure definition */ 189*86d7f5d3SJohn Marino #define NG_PPP_STATS_TYPE_INFO { \ 190*86d7f5d3SJohn Marino { "xmitFrames", &ng_parse_uint32_type }, \ 191*86d7f5d3SJohn Marino { "xmitOctets", &ng_parse_uint32_type }, \ 192*86d7f5d3SJohn Marino { "recvFrames", &ng_parse_uint32_type }, \ 193*86d7f5d3SJohn Marino { "recvOctets", &ng_parse_uint32_type }, \ 194*86d7f5d3SJohn Marino { "badProtos", &ng_parse_uint32_type }, \ 195*86d7f5d3SJohn Marino { "runts", &ng_parse_uint32_type }, \ 196*86d7f5d3SJohn Marino { "dupFragments", &ng_parse_uint32_type }, \ 197*86d7f5d3SJohn Marino { "dropFragments", &ng_parse_uint32_type }, \ 198*86d7f5d3SJohn Marino { NULL } \ 199*86d7f5d3SJohn Marino } 200*86d7f5d3SJohn Marino 201*86d7f5d3SJohn Marino #endif /* _NETGRAPH_PPP_H_ */ 202