ng_ppp.h revision 59882
152419Sjulian 252419Sjulian/* 352419Sjulian * ng_ppp.h 452419Sjulian * 559882Sarchie * Copyright (c) 1996-2000 Whistle Communications, Inc. 652419Sjulian * All rights reserved. 752419Sjulian * 852419Sjulian * Subject to the following obligations and disclaimer of warranty, use and 952419Sjulian * redistribution of this software, in source or object code forms, with or 1052419Sjulian * without modifications are expressly permitted by Whistle Communications; 1152419Sjulian * provided, however, that: 1252419Sjulian * 1. Any and all reproductions of the source or object code must include the 1352419Sjulian * copyright notice above and the following disclaimer of warranties; and 1452419Sjulian * 2. No rights are granted, in any manner or form, to use Whistle 1552419Sjulian * Communications, Inc. trademarks, including the mark "WHISTLE 1652419Sjulian * COMMUNICATIONS" on advertising, endorsements, or otherwise except as 1752419Sjulian * such appears in the above copyright notice or in the software. 1852419Sjulian * 1952419Sjulian * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND 2052419Sjulian * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO 2152419Sjulian * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, 2252419Sjulian * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF 2352419Sjulian * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. 2452419Sjulian * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY 2552419Sjulian * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS 2652419Sjulian * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE. 2752419Sjulian * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES 2852419Sjulian * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING 2952419Sjulian * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 3052419Sjulian * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR 3152419Sjulian * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY 3252419Sjulian * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 3352419Sjulian * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 3452419Sjulian * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY 3552419Sjulian * OF SUCH DAMAGE. 3652419Sjulian * 3752419Sjulian * Author: Archie Cobbs <archie@whistle.com> 3852419Sjulian * 3952419Sjulian * $FreeBSD: head/sys/netgraph/ng_ppp.h 59882 2000-05-02 00:09:18Z archie $ 4052419Sjulian * $Whistle: ng_ppp.h,v 1.8 1999/01/25 02:40:02 archie Exp $ 4152419Sjulian */ 4252419Sjulian 4352419Sjulian#ifndef _NETGRAPH_PPP_H_ 4452419Sjulian#define _NETGRAPH_PPP_H_ 4552419Sjulian 4652419Sjulian/* Node type name and magic cookie */ 4752419Sjulian#define NG_PPP_NODE_TYPE "ppp" 4859882Sarchie#define NGM_PPP_COOKIE 940897794 4952419Sjulian 5052639Sarchie/* Maximum number of supported links */ 5152639Sarchie#define NG_PPP_MAX_LINKS 16 5252639Sarchie 5352639Sarchie/* Pseudo-link number representing the multi-link bundle */ 5452639Sarchie#define NG_PPP_BUNDLE_LINKNUM 0xffff 5552639Sarchie 5652639Sarchie/* Max allowable link latency (miliseconds) and bandwidth (bytes/second/10) */ 5752639Sarchie#define NG_PPP_MAX_LATENCY 1000 /* 1 second */ 5852639Sarchie#define NG_PPP_MAX_BANDWIDTH 125000 /* 10 Mbits / second */ 5952639Sarchie 6052419Sjulian/* Hook names */ 6152639Sarchie#define NG_PPP_HOOK_BYPASS "bypass" /* unknown protocols */ 6252639Sarchie#define NG_PPP_HOOK_COMPRESS "compress" /* outgoing compression */ 6352639Sarchie#define NG_PPP_HOOK_DECOMPRESS "decompress" /* incoming decompression */ 6452639Sarchie#define NG_PPP_HOOK_ENCRYPT "encrypt" /* outgoing encryption */ 6552639Sarchie#define NG_PPP_HOOK_DECRYPT "decrypt" /* incoming decryption */ 6652639Sarchie#define NG_PPP_HOOK_VJC_IP "vjc_ip" /* VJC raw IP */ 6752639Sarchie#define NG_PPP_HOOK_VJC_COMP "vjc_vjcomp" /* VJC compressed TCP */ 6852639Sarchie#define NG_PPP_HOOK_VJC_UNCOMP "vjc_vjuncomp" /* VJC uncompressed TCP */ 6952639Sarchie#define NG_PPP_HOOK_VJC_VJIP "vjc_vjip" /* VJC uncompressed IP */ 7052639Sarchie#define NG_PPP_HOOK_INET "inet" /* IP packet data */ 7152639Sarchie#define NG_PPP_HOOK_ATALK "atalk" /* AppleTalk packet data */ 7252639Sarchie#define NG_PPP_HOOK_IPX "ipx" /* IPX packet data */ 7359882Sarchie#define NG_PPP_HOOK_IPV6 "ipv6" /* IPv6 packet data */ 7452419Sjulian 7552639Sarchie#define NG_PPP_HOOK_LINK_PREFIX "link" /* append decimal link number */ 7652639Sarchie 7752419Sjulian/* Netgraph commands */ 7852419Sjulianenum { 7959882Sarchie NGM_PPP_SET_CONFIG = 1, /* takes struct ng_ppp_node_conf */ 8059882Sarchie NGM_PPP_GET_CONFIG, /* returns ng_ppp_node_conf */ 8152639Sarchie NGM_PPP_GET_LINK_STATS, /* takes link #, returns stats struct */ 8252639Sarchie NGM_PPP_CLR_LINK_STATS, /* takes link #, clears link stats */ 8352912Sarchie NGM_PPP_GETCLR_LINK_STATS, /* takes link #, returns & clrs stats */ 8452419Sjulian}; 8552419Sjulian 8652639Sarchie/* Per-link config structure */ 8759882Sarchiestruct ng_ppp_link_conf { 8852639Sarchie u_char enableLink; /* enable this link */ 8952639Sarchie u_char enableProtoComp;/* enable protocol field compression */ 9053075Sarchie u_char enableACFComp; /* enable addr/ctrl field compression */ 9152639Sarchie u_int16_t mru; /* peer MRU */ 9252639Sarchie u_int32_t latency; /* link latency (in milliseconds) */ 9352639Sarchie u_int32_t bandwidth; /* link bandwidth (in bytes/second) */ 9452419Sjulian}; 9552419Sjulian 9653913Sarchie/* Keep this in sync with the above structure definition */ 9753913Sarchie#define NG_PPP_LINK_TYPE_INFO { \ 9853913Sarchie { \ 9959882Sarchie { "enableLink", &ng_parse_int8_type }, \ 10059882Sarchie { "enableProtoComp", &ng_parse_int8_type }, \ 10159882Sarchie { "enableACFComp", &ng_parse_int8_type }, \ 10253913Sarchie { "mru", &ng_parse_int16_type }, \ 10353913Sarchie { "latency", &ng_parse_int32_type }, \ 10453913Sarchie { "bandwidth", &ng_parse_int32_type }, \ 10553913Sarchie { NULL }, \ 10653913Sarchie } \ 10753913Sarchie} 10853913Sarchie 10959882Sarchie/* Bundle config structure */ 11059882Sarchiestruct ng_ppp_bund_conf { 11152639Sarchie u_int16_t mrru; /* multilink peer MRRU */ 11252639Sarchie u_char enableMultilink; /* enable multilink */ 11352639Sarchie u_char recvShortSeq; /* recv multilink short seq # */ 11452639Sarchie u_char xmitShortSeq; /* xmit multilink short seq # */ 11552639Sarchie u_char enableRoundRobin; /* xmit whole packets */ 11652639Sarchie u_char enableIP; /* enable IP data flow */ 11759882Sarchie u_char enableIPv6; /* enable IPv6 data flow */ 11852639Sarchie u_char enableAtalk; /* enable AppleTalk data flow */ 11952639Sarchie u_char enableIPX; /* enable IPX data flow */ 12052639Sarchie u_char enableCompression; /* enable PPP compression */ 12152639Sarchie u_char enableDecompression; /* enable PPP decompression */ 12252639Sarchie u_char enableEncryption; /* enable PPP encryption */ 12352639Sarchie u_char enableDecryption; /* enable PPP decryption */ 12452639Sarchie u_char enableVJCompression; /* enable VJ compression */ 12552639Sarchie u_char enableVJDecompression; /* enable VJ decompression */ 12652639Sarchie}; 12752419Sjulian 12853913Sarchie/* Keep this in sync with the above structure definition */ 12959882Sarchie#define NG_PPP_BUND_TYPE_INFO { \ 13059882Sarchie { \ 13159882Sarchie { "mrru", &ng_parse_int16_type }, \ 13259882Sarchie { "enableMultilink", &ng_parse_int8_type }, \ 13359882Sarchie { "recvShortSeq", &ng_parse_int8_type }, \ 13459882Sarchie { "xmitShortSeq", &ng_parse_int8_type }, \ 13559882Sarchie { "enableRoundRobin", &ng_parse_int8_type }, \ 13659882Sarchie { "enableIP", &ng_parse_int8_type }, \ 13759882Sarchie { "enableIPv6", &ng_parse_int8_type }, \ 13859882Sarchie { "enableAtalk", &ng_parse_int8_type }, \ 13959882Sarchie { "enableIPX", &ng_parse_int8_type }, \ 14059882Sarchie { "enableCompression", &ng_parse_int8_type }, \ 14159882Sarchie { "enableDecompression", &ng_parse_int8_type }, \ 14259882Sarchie { "enableEncryption", &ng_parse_int8_type }, \ 14359882Sarchie { "enableDecryption", &ng_parse_int8_type }, \ 14459882Sarchie { "enableVJCompression", &ng_parse_int8_type }, \ 14559882Sarchie { "enableVJDecompression", &ng_parse_int8_type }, \ 14659882Sarchie { NULL } \ 14759882Sarchie } \ 14859882Sarchie} 14959882Sarchie 15059882Sarchie/* Total node config structure */ 15159882Sarchiestruct ng_ppp_node_conf { 15259882Sarchie struct ng_ppp_bund_conf bund; 15359882Sarchie struct ng_ppp_link_conf links[NG_PPP_MAX_LINKS]; 15459882Sarchie}; 15559882Sarchie 15659882Sarchie/* Keep this in sync with the above structure definition */ 15759882Sarchie#define NG_PPP_CONFIG_TYPE_INFO(bctype, arytype) { \ 15853913Sarchie { \ 15959882Sarchie { "bund", (bctype) }, \ 16059882Sarchie { "links", (arytype) }, \ 16159882Sarchie { NULL } \ 16253913Sarchie } \ 16353913Sarchie} 16453913Sarchie 16552639Sarchie/* Statistics struct for a link (or the bundle if NG_PPP_BUNDLE_LINKNUM) */ 16652639Sarchiestruct ng_ppp_link_stat { 16752639Sarchie u_int32_t xmitFrames; /* xmit frames on link */ 16852639Sarchie u_int32_t xmitOctets; /* xmit octets on link */ 16952639Sarchie u_int32_t recvFrames; /* recv frames on link */ 17052639Sarchie u_int32_t recvOctets; /* recv octets on link */ 17152639Sarchie u_int32_t badProtos; /* frames rec'd with bogus protocol */ 17259882Sarchie u_int32_t runts; /* Too short MP fragments */ 17352639Sarchie u_int32_t dupFragments; /* MP frames with duplicate seq # */ 17459882Sarchie u_int32_t dropFragments; /* MP fragments we had to drop */ 17552639Sarchie}; 17652639Sarchie 17753913Sarchie/* Keep this in sync with the above structure definition */ 17853913Sarchie#define NG_PPP_STATS_TYPE_INFO { \ 17953913Sarchie { \ 18053913Sarchie { "xmitFrames", &ng_parse_int32_type }, \ 18153913Sarchie { "xmitOctets", &ng_parse_int32_type }, \ 18253913Sarchie { "recvFrames", &ng_parse_int32_type }, \ 18353913Sarchie { "recvOctets", &ng_parse_int32_type }, \ 18453913Sarchie { "badProtos", &ng_parse_int32_type }, \ 18559882Sarchie { "runts", &ng_parse_int32_type }, \ 18653913Sarchie { "dupFragments", &ng_parse_int32_type }, \ 18759882Sarchie { "dropFragments", &ng_parse_int32_type }, \ 18859882Sarchie { NULL } \ 18953913Sarchie } \ 19053913Sarchie} 19153913Sarchie 19252419Sjulian#endif /* _NETGRAPH_PPP_H_ */ 193