152419Sjulian/* 252419Sjulian * ng_ppp.h 3139823Simp */ 4139823Simp 5139823Simp/*- 659882Sarchie * Copyright (c) 1996-2000 Whistle Communications, Inc. 752419Sjulian * All rights reserved. 852419Sjulian * 952419Sjulian * Subject to the following obligations and disclaimer of warranty, use and 1052419Sjulian * redistribution of this software, in source or object code forms, with or 1152419Sjulian * without modifications are expressly permitted by Whistle Communications; 1252419Sjulian * provided, however, that: 1352419Sjulian * 1. Any and all reproductions of the source or object code must include the 1452419Sjulian * copyright notice above and the following disclaimer of warranties; and 1552419Sjulian * 2. No rights are granted, in any manner or form, to use Whistle 1652419Sjulian * Communications, Inc. trademarks, including the mark "WHISTLE 1752419Sjulian * COMMUNICATIONS" on advertising, endorsements, or otherwise except as 1852419Sjulian * such appears in the above copyright notice or in the software. 1952419Sjulian * 2052419Sjulian * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND 2152419Sjulian * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO 2252419Sjulian * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, 2352419Sjulian * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF 2452419Sjulian * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. 2552419Sjulian * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY 2652419Sjulian * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS 2752419Sjulian * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE. 2852419Sjulian * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES 2952419Sjulian * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING 3052419Sjulian * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 3152419Sjulian * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR 3252419Sjulian * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY 3352419Sjulian * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 3452419Sjulian * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 3552419Sjulian * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY 3652419Sjulian * OF SUCH DAMAGE. 3752419Sjulian * 3866775Sarchie * Author: Archie Cobbs <archie@freebsd.org> 3952419Sjulian * 4052419Sjulian * $FreeBSD$ 4152419Sjulian * $Whistle: ng_ppp.h,v 1.8 1999/01/25 02:40:02 archie Exp $ 4252419Sjulian */ 4352419Sjulian 44122481Sru#ifndef _NETGRAPH_NG_PPP_H_ 45122481Sru#define _NETGRAPH_NG_PPP_H_ 4652419Sjulian 4752419Sjulian/* Node type name and magic cookie */ 4852419Sjulian#define NG_PPP_NODE_TYPE "ppp" 4966775Sarchie#define NGM_PPP_COOKIE 940897795 5052419Sjulian 51171688Smav/* 64bit stats presence flag */ 52171688Smav#define NG_PPP_STATS64 53171688Smav 5452639Sarchie/* Maximum number of supported links */ 5552639Sarchie#define NG_PPP_MAX_LINKS 16 5652639Sarchie 5752639Sarchie/* Pseudo-link number representing the multi-link bundle */ 5852639Sarchie#define NG_PPP_BUNDLE_LINKNUM 0xffff 5952639Sarchie 6052639Sarchie/* Max allowable link latency (miliseconds) and bandwidth (bytes/second/10) */ 6152639Sarchie#define NG_PPP_MAX_LATENCY 1000 /* 1 second */ 6252639Sarchie#define NG_PPP_MAX_BANDWIDTH 125000 /* 10 Mbits / second */ 6352639Sarchie 6452419Sjulian/* Hook names */ 6552639Sarchie#define NG_PPP_HOOK_BYPASS "bypass" /* unknown protocols */ 6652639Sarchie#define NG_PPP_HOOK_COMPRESS "compress" /* outgoing compression */ 6752639Sarchie#define NG_PPP_HOOK_DECOMPRESS "decompress" /* incoming decompression */ 6852639Sarchie#define NG_PPP_HOOK_ENCRYPT "encrypt" /* outgoing encryption */ 6952639Sarchie#define NG_PPP_HOOK_DECRYPT "decrypt" /* incoming decryption */ 7052639Sarchie#define NG_PPP_HOOK_VJC_IP "vjc_ip" /* VJC raw IP */ 7152639Sarchie#define NG_PPP_HOOK_VJC_COMP "vjc_vjcomp" /* VJC compressed TCP */ 7252639Sarchie#define NG_PPP_HOOK_VJC_UNCOMP "vjc_vjuncomp" /* VJC uncompressed TCP */ 7352639Sarchie#define NG_PPP_HOOK_VJC_VJIP "vjc_vjip" /* VJC uncompressed IP */ 7452639Sarchie#define NG_PPP_HOOK_INET "inet" /* IP packet data */ 7552639Sarchie#define NG_PPP_HOOK_ATALK "atalk" /* AppleTalk packet data */ 7652639Sarchie#define NG_PPP_HOOK_IPX "ipx" /* IPX packet data */ 7759882Sarchie#define NG_PPP_HOOK_IPV6 "ipv6" /* IPv6 packet data */ 7852419Sjulian 7952639Sarchie#define NG_PPP_HOOK_LINK_PREFIX "link" /* append decimal link number */ 8052639Sarchie 81165580Sglebius/* Compress hook operation modes */ 82165580Sglebiusenum { 83165580Sglebius NG_PPP_COMPRESS_NONE = 0, /* compression disabled */ 84165580Sglebius NG_PPP_COMPRESS_SIMPLE, /* original operation mode */ 85165580Sglebius NG_PPP_COMPRESS_FULL, /* compressor returns proto */ 86165580Sglebius}; 87165580Sglebius 88165580Sglebius/* Decompress hook operation modes */ 89165580Sglebiusenum { 90165580Sglebius NG_PPP_DECOMPRESS_NONE = 0, /* decompression disabled */ 91165580Sglebius NG_PPP_DECOMPRESS_SIMPLE, /* original operation mode */ 92165580Sglebius NG_PPP_DECOMPRESS_FULL, /* forward any packet to decompressor */ 93165580Sglebius}; 94165580Sglebius 9552419Sjulian/* Netgraph commands */ 9652419Sjulianenum { 9759882Sarchie NGM_PPP_SET_CONFIG = 1, /* takes struct ng_ppp_node_conf */ 9859882Sarchie NGM_PPP_GET_CONFIG, /* returns ng_ppp_node_conf */ 9966775Sarchie NGM_PPP_GET_MP_STATE, /* returns ng_ppp_mp_state */ 10052639Sarchie NGM_PPP_GET_LINK_STATS, /* takes link #, returns stats struct */ 10152639Sarchie NGM_PPP_CLR_LINK_STATS, /* takes link #, clears link stats */ 10252912Sarchie NGM_PPP_GETCLR_LINK_STATS, /* takes link #, returns & clrs stats */ 103171688Smav NGM_PPP_GET_LINK_STATS64, /* takes link #, returns stats64 struct */ 104171688Smav NGM_PPP_GETCLR_LINK_STATS64, /* takes link #, returns stats64 & clrs */ 10552419Sjulian}; 10652419Sjulian 10766775Sarchie/* Multi-link sequence number state (for debugging) */ 10866775Sarchiestruct ng_ppp_mp_state { 10966775Sarchie int32_t rseq[NG_PPP_MAX_LINKS]; /* highest rec'd MP seq # */ 11066775Sarchie int32_t mseq; /* min rseq[i] */ 11166775Sarchie int32_t xseq; /* next xmit MP seq # */ 11266775Sarchie}; 11366775Sarchie 11466775Sarchie/* Keep this in sync with the above structure definition */ 11566775Sarchie#define NG_PPP_MP_STATE_TYPE_INFO(atype) { \ 11666775Sarchie { "rseq", (atype) }, \ 11766775Sarchie { "mseq", &ng_parse_hint32_type }, \ 11866775Sarchie { "xseq", &ng_parse_hint32_type }, \ 11997685Sarchie { NULL } \ 12066775Sarchie} 12166775Sarchie 12252639Sarchie/* Per-link config structure */ 12359882Sarchiestruct ng_ppp_link_conf { 12452639Sarchie u_char enableLink; /* enable this link */ 12552639Sarchie u_char enableProtoComp;/* enable protocol field compression */ 12653075Sarchie u_char enableACFComp; /* enable addr/ctrl field compression */ 12752639Sarchie u_int16_t mru; /* peer MRU */ 12852639Sarchie u_int32_t latency; /* link latency (in milliseconds) */ 129141598Sarchie u_int32_t bandwidth; /* link bandwidth (in bytes/sec/10) */ 13052419Sjulian}; 13152419Sjulian 13253913Sarchie/* Keep this in sync with the above structure definition */ 13353913Sarchie#define NG_PPP_LINK_TYPE_INFO { \ 13464508Sarchie { "enableLink", &ng_parse_uint8_type }, \ 13564508Sarchie { "enableProtoComp", &ng_parse_uint8_type }, \ 13664508Sarchie { "enableACFComp", &ng_parse_uint8_type }, \ 13764508Sarchie { "mru", &ng_parse_uint16_type }, \ 13864508Sarchie { "latency", &ng_parse_uint32_type }, \ 13964508Sarchie { "bandwidth", &ng_parse_uint32_type }, \ 14097685Sarchie { NULL } \ 14153913Sarchie} 14253913Sarchie 14359882Sarchie/* Bundle config structure */ 14459882Sarchiestruct ng_ppp_bund_conf { 14552639Sarchie u_int16_t mrru; /* multilink peer MRRU */ 14652639Sarchie u_char enableMultilink; /* enable multilink */ 14752639Sarchie u_char recvShortSeq; /* recv multilink short seq # */ 14852639Sarchie u_char xmitShortSeq; /* xmit multilink short seq # */ 14952639Sarchie u_char enableRoundRobin; /* xmit whole packets */ 15052639Sarchie u_char enableIP; /* enable IP data flow */ 15159882Sarchie u_char enableIPv6; /* enable IPv6 data flow */ 15252639Sarchie u_char enableAtalk; /* enable AppleTalk data flow */ 15352639Sarchie u_char enableIPX; /* enable IPX data flow */ 15452639Sarchie u_char enableCompression; /* enable PPP compression */ 15552639Sarchie u_char enableDecompression; /* enable PPP decompression */ 15652639Sarchie u_char enableEncryption; /* enable PPP encryption */ 15752639Sarchie u_char enableDecryption; /* enable PPP decryption */ 15852639Sarchie u_char enableVJCompression; /* enable VJ compression */ 15952639Sarchie u_char enableVJDecompression; /* enable VJ decompression */ 16052639Sarchie}; 16152419Sjulian 16253913Sarchie/* Keep this in sync with the above structure definition */ 16359882Sarchie#define NG_PPP_BUND_TYPE_INFO { \ 16464508Sarchie { "mrru", &ng_parse_uint16_type }, \ 16564508Sarchie { "enableMultilink", &ng_parse_uint8_type }, \ 16664508Sarchie { "recvShortSeq", &ng_parse_uint8_type }, \ 16764508Sarchie { "xmitShortSeq", &ng_parse_uint8_type }, \ 16864508Sarchie { "enableRoundRobin", &ng_parse_uint8_type }, \ 16964508Sarchie { "enableIP", &ng_parse_uint8_type }, \ 17064508Sarchie { "enableIPv6", &ng_parse_uint8_type }, \ 17164508Sarchie { "enableAtalk", &ng_parse_uint8_type }, \ 17264508Sarchie { "enableIPX", &ng_parse_uint8_type }, \ 17364508Sarchie { "enableCompression", &ng_parse_uint8_type }, \ 17464508Sarchie { "enableDecompression", &ng_parse_uint8_type }, \ 17564508Sarchie { "enableEncryption", &ng_parse_uint8_type }, \ 17664508Sarchie { "enableDecryption", &ng_parse_uint8_type }, \ 17764508Sarchie { "enableVJCompression", &ng_parse_uint8_type }, \ 17864508Sarchie { "enableVJDecompression", &ng_parse_uint8_type }, \ 17959882Sarchie { NULL } \ 18059882Sarchie} 18159882Sarchie 18259882Sarchie/* Total node config structure */ 18359882Sarchiestruct ng_ppp_node_conf { 18459882Sarchie struct ng_ppp_bund_conf bund; 18559882Sarchie struct ng_ppp_link_conf links[NG_PPP_MAX_LINKS]; 18659882Sarchie}; 18759882Sarchie 18859882Sarchie/* Keep this in sync with the above structure definition */ 18959882Sarchie#define NG_PPP_CONFIG_TYPE_INFO(bctype, arytype) { \ 19059882Sarchie { "bund", (bctype) }, \ 19159882Sarchie { "links", (arytype) }, \ 19259882Sarchie { NULL } \ 19353913Sarchie} 19453913Sarchie 19552639Sarchie/* Statistics struct for a link (or the bundle if NG_PPP_BUNDLE_LINKNUM) */ 19652639Sarchiestruct ng_ppp_link_stat { 19752639Sarchie u_int32_t xmitFrames; /* xmit frames on link */ 19852639Sarchie u_int32_t xmitOctets; /* xmit octets on link */ 19952639Sarchie u_int32_t recvFrames; /* recv frames on link */ 20052639Sarchie u_int32_t recvOctets; /* recv octets on link */ 20152639Sarchie u_int32_t badProtos; /* frames rec'd with bogus protocol */ 20259882Sarchie u_int32_t runts; /* Too short MP fragments */ 20352639Sarchie u_int32_t dupFragments; /* MP frames with duplicate seq # */ 20459882Sarchie u_int32_t dropFragments; /* MP fragments we had to drop */ 20552639Sarchie}; 20652639Sarchie 20753913Sarchie/* Keep this in sync with the above structure definition */ 20853913Sarchie#define NG_PPP_STATS_TYPE_INFO { \ 20964508Sarchie { "xmitFrames", &ng_parse_uint32_type }, \ 21064508Sarchie { "xmitOctets", &ng_parse_uint32_type }, \ 21164508Sarchie { "recvFrames", &ng_parse_uint32_type }, \ 21264508Sarchie { "recvOctets", &ng_parse_uint32_type }, \ 21364508Sarchie { "badProtos", &ng_parse_uint32_type }, \ 21464508Sarchie { "runts", &ng_parse_uint32_type }, \ 21564508Sarchie { "dupFragments", &ng_parse_uint32_type }, \ 21664508Sarchie { "dropFragments", &ng_parse_uint32_type }, \ 21759882Sarchie { NULL } \ 21853913Sarchie} 21953913Sarchie 220171688Smav/* Statistics struct for a link (or the bundle if NG_PPP_BUNDLE_LINKNUM) */ 221171688Smavstruct ng_ppp_link_stat64 { 222171688Smav u_int64_t xmitFrames; /* xmit frames on link */ 223171688Smav u_int64_t xmitOctets; /* xmit octets on link */ 224171688Smav u_int64_t recvFrames; /* recv frames on link */ 225171688Smav u_int64_t recvOctets; /* recv octets on link */ 226171688Smav u_int64_t badProtos; /* frames rec'd with bogus protocol */ 227171688Smav u_int64_t runts; /* Too short MP fragments */ 228171688Smav u_int64_t dupFragments; /* MP frames with duplicate seq # */ 229171688Smav u_int64_t dropFragments; /* MP fragments we had to drop */ 230171688Smav}; 231171688Smav 232171688Smav/* Keep this in sync with the above structure definition */ 233171688Smav#define NG_PPP_STATS64_TYPE_INFO { \ 234171688Smav { "xmitFrames", &ng_parse_uint64_type }, \ 235171688Smav { "xmitOctets", &ng_parse_uint64_type }, \ 236171688Smav { "recvFrames", &ng_parse_uint64_type }, \ 237171688Smav { "recvOctets", &ng_parse_uint64_type }, \ 238171688Smav { "badProtos", &ng_parse_uint64_type }, \ 239171688Smav { "runts", &ng_parse_uint64_type }, \ 240171688Smav { "dupFragments", &ng_parse_uint64_type }, \ 241171688Smav { "dropFragments", &ng_parse_uint64_type }, \ 242171688Smav { NULL } \ 243171688Smav} 244171688Smav 245122481Sru#endif /* _NETGRAPH_NG_PPP_H_ */ 246