ng_ppp.h revision 66775
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 * 3766775Sarchie * Author: Archie Cobbs <archie@freebsd.org> 3852419Sjulian * 3952419Sjulian * $FreeBSD: head/sys/netgraph/ng_ppp.h 66775 2000-10-06 23:42:02Z 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" 4866775Sarchie#define NGM_PPP_COOKIE 940897795 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 */ 8166775Sarchie NGM_PPP_GET_MP_STATE, /* returns ng_ppp_mp_state */ 8252639Sarchie NGM_PPP_GET_LINK_STATS, /* takes link #, returns stats struct */ 8352639Sarchie NGM_PPP_CLR_LINK_STATS, /* takes link #, clears link stats */ 8452912Sarchie NGM_PPP_GETCLR_LINK_STATS, /* takes link #, returns & clrs stats */ 8552419Sjulian}; 8652419Sjulian 8766775Sarchie/* Multi-link sequence number state (for debugging) */ 8866775Sarchiestruct ng_ppp_mp_state { 8966775Sarchie int32_t rseq[NG_PPP_MAX_LINKS]; /* highest rec'd MP seq # */ 9066775Sarchie int32_t mseq; /* min rseq[i] */ 9166775Sarchie int32_t xseq; /* next xmit MP seq # */ 9266775Sarchie}; 9366775Sarchie 9466775Sarchie/* Keep this in sync with the above structure definition */ 9566775Sarchie#define NG_PPP_MP_STATE_TYPE_INFO(atype) { \ 9666775Sarchie { \ 9766775Sarchie { "rseq", (atype) }, \ 9866775Sarchie { "mseq", &ng_parse_hint32_type }, \ 9966775Sarchie { "xseq", &ng_parse_hint32_type }, \ 10066775Sarchie { NULL }, \ 10166775Sarchie } \ 10266775Sarchie} 10366775Sarchie 10452639Sarchie/* Per-link config structure */ 10559882Sarchiestruct ng_ppp_link_conf { 10652639Sarchie u_char enableLink; /* enable this link */ 10752639Sarchie u_char enableProtoComp;/* enable protocol field compression */ 10853075Sarchie u_char enableACFComp; /* enable addr/ctrl field compression */ 10952639Sarchie u_int16_t mru; /* peer MRU */ 11052639Sarchie u_int32_t latency; /* link latency (in milliseconds) */ 11152639Sarchie u_int32_t bandwidth; /* link bandwidth (in bytes/second) */ 11252419Sjulian}; 11352419Sjulian 11453913Sarchie/* Keep this in sync with the above structure definition */ 11553913Sarchie#define NG_PPP_LINK_TYPE_INFO { \ 11653913Sarchie { \ 11764508Sarchie { "enableLink", &ng_parse_uint8_type }, \ 11864508Sarchie { "enableProtoComp", &ng_parse_uint8_type }, \ 11964508Sarchie { "enableACFComp", &ng_parse_uint8_type }, \ 12064508Sarchie { "mru", &ng_parse_uint16_type }, \ 12164508Sarchie { "latency", &ng_parse_uint32_type }, \ 12264508Sarchie { "bandwidth", &ng_parse_uint32_type }, \ 12353913Sarchie { NULL }, \ 12453913Sarchie } \ 12553913Sarchie} 12653913Sarchie 12759882Sarchie/* Bundle config structure */ 12859882Sarchiestruct ng_ppp_bund_conf { 12952639Sarchie u_int16_t mrru; /* multilink peer MRRU */ 13052639Sarchie u_char enableMultilink; /* enable multilink */ 13152639Sarchie u_char recvShortSeq; /* recv multilink short seq # */ 13252639Sarchie u_char xmitShortSeq; /* xmit multilink short seq # */ 13352639Sarchie u_char enableRoundRobin; /* xmit whole packets */ 13452639Sarchie u_char enableIP; /* enable IP data flow */ 13559882Sarchie u_char enableIPv6; /* enable IPv6 data flow */ 13652639Sarchie u_char enableAtalk; /* enable AppleTalk data flow */ 13752639Sarchie u_char enableIPX; /* enable IPX data flow */ 13852639Sarchie u_char enableCompression; /* enable PPP compression */ 13952639Sarchie u_char enableDecompression; /* enable PPP decompression */ 14052639Sarchie u_char enableEncryption; /* enable PPP encryption */ 14152639Sarchie u_char enableDecryption; /* enable PPP decryption */ 14252639Sarchie u_char enableVJCompression; /* enable VJ compression */ 14352639Sarchie u_char enableVJDecompression; /* enable VJ decompression */ 14452639Sarchie}; 14552419Sjulian 14653913Sarchie/* Keep this in sync with the above structure definition */ 14759882Sarchie#define NG_PPP_BUND_TYPE_INFO { \ 14859882Sarchie { \ 14964508Sarchie { "mrru", &ng_parse_uint16_type }, \ 15064508Sarchie { "enableMultilink", &ng_parse_uint8_type }, \ 15164508Sarchie { "recvShortSeq", &ng_parse_uint8_type }, \ 15264508Sarchie { "xmitShortSeq", &ng_parse_uint8_type }, \ 15364508Sarchie { "enableRoundRobin", &ng_parse_uint8_type }, \ 15464508Sarchie { "enableIP", &ng_parse_uint8_type }, \ 15564508Sarchie { "enableIPv6", &ng_parse_uint8_type }, \ 15664508Sarchie { "enableAtalk", &ng_parse_uint8_type }, \ 15764508Sarchie { "enableIPX", &ng_parse_uint8_type }, \ 15864508Sarchie { "enableCompression", &ng_parse_uint8_type }, \ 15964508Sarchie { "enableDecompression", &ng_parse_uint8_type }, \ 16064508Sarchie { "enableEncryption", &ng_parse_uint8_type }, \ 16164508Sarchie { "enableDecryption", &ng_parse_uint8_type }, \ 16264508Sarchie { "enableVJCompression", &ng_parse_uint8_type }, \ 16364508Sarchie { "enableVJDecompression", &ng_parse_uint8_type }, \ 16459882Sarchie { NULL } \ 16559882Sarchie } \ 16659882Sarchie} 16759882Sarchie 16859882Sarchie/* Total node config structure */ 16959882Sarchiestruct ng_ppp_node_conf { 17059882Sarchie struct ng_ppp_bund_conf bund; 17159882Sarchie struct ng_ppp_link_conf links[NG_PPP_MAX_LINKS]; 17259882Sarchie}; 17359882Sarchie 17459882Sarchie/* Keep this in sync with the above structure definition */ 17559882Sarchie#define NG_PPP_CONFIG_TYPE_INFO(bctype, arytype) { \ 17653913Sarchie { \ 17759882Sarchie { "bund", (bctype) }, \ 17859882Sarchie { "links", (arytype) }, \ 17959882Sarchie { NULL } \ 18053913Sarchie } \ 18153913Sarchie} 18253913Sarchie 18352639Sarchie/* Statistics struct for a link (or the bundle if NG_PPP_BUNDLE_LINKNUM) */ 18452639Sarchiestruct ng_ppp_link_stat { 18552639Sarchie u_int32_t xmitFrames; /* xmit frames on link */ 18652639Sarchie u_int32_t xmitOctets; /* xmit octets on link */ 18752639Sarchie u_int32_t recvFrames; /* recv frames on link */ 18852639Sarchie u_int32_t recvOctets; /* recv octets on link */ 18952639Sarchie u_int32_t badProtos; /* frames rec'd with bogus protocol */ 19059882Sarchie u_int32_t runts; /* Too short MP fragments */ 19152639Sarchie u_int32_t dupFragments; /* MP frames with duplicate seq # */ 19259882Sarchie u_int32_t dropFragments; /* MP fragments we had to drop */ 19352639Sarchie}; 19452639Sarchie 19553913Sarchie/* Keep this in sync with the above structure definition */ 19653913Sarchie#define NG_PPP_STATS_TYPE_INFO { \ 19753913Sarchie { \ 19864508Sarchie { "xmitFrames", &ng_parse_uint32_type }, \ 19964508Sarchie { "xmitOctets", &ng_parse_uint32_type }, \ 20064508Sarchie { "recvFrames", &ng_parse_uint32_type }, \ 20164508Sarchie { "recvOctets", &ng_parse_uint32_type }, \ 20264508Sarchie { "badProtos", &ng_parse_uint32_type }, \ 20364508Sarchie { "runts", &ng_parse_uint32_type }, \ 20464508Sarchie { "dupFragments", &ng_parse_uint32_type }, \ 20564508Sarchie { "dropFragments", &ng_parse_uint32_type }, \ 20659882Sarchie { NULL } \ 20753913Sarchie } \ 20853913Sarchie} 20953913Sarchie 21052419Sjulian#endif /* _NETGRAPH_PPP_H_ */ 211