ng_ppp.h revision 53913
152419Sjulian
252419Sjulian/*
352419Sjulian * ng_ppp.h
452419Sjulian *
552419Sjulian * Copyright (c) 1996-1999 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 53913 1999-11-30 02:45:32Z 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"
4853075Sarchie#define NGM_PPP_COOKIE		940897793
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 */
7352419Sjulian
7452639Sarchie#define NG_PPP_HOOK_LINK_PREFIX	"link"		/* append decimal link number */
7552639Sarchie
7652419Sjulian/* Netgraph commands */
7752419Sjulianenum {
7852639Sarchie	NGM_PPP_SET_CONFIG = 1,		/* takes struct ng_ppp_bundle_config */
7952639Sarchie	NGM_PPP_GET_CONFIG,		/* returns ng_ppp_bundle_config */
8052639Sarchie	NGM_PPP_GET_LINK_STATS,		/* takes link #, returns stats struct */
8152639Sarchie	NGM_PPP_CLR_LINK_STATS,		/* takes link #, clears link stats */
8252912Sarchie	NGM_PPP_GETCLR_LINK_STATS,	/* takes link #, returns & clrs stats */
8352419Sjulian};
8452419Sjulian
8552639Sarchie/* Per-link config structure */
8652639Sarchiestruct ng_ppp_link_config {
8752639Sarchie	u_char		enableLink;	/* enable this link */
8852639Sarchie	u_char		enableProtoComp;/* enable protocol field compression */
8953075Sarchie	u_char		enableACFComp;	/* enable addr/ctrl field compression */
9052639Sarchie	u_int16_t	mru;		/* peer MRU */
9152639Sarchie	u_int32_t	latency;	/* link latency (in milliseconds) */
9252639Sarchie	u_int32_t	bandwidth;	/* link bandwidth (in bytes/second) */
9352419Sjulian};
9452419Sjulian
9553913Sarchie/* Keep this in sync with the above structure definition */
9653913Sarchie#define NG_PPP_LINK_TYPE_INFO	{				\
9753913Sarchie	{							\
9853913Sarchie	  { "enable",		&ng_parse_int8_type	},	\
9953913Sarchie	  { "protocomp",	&ng_parse_int8_type	},	\
10053913Sarchie	  { "acfcomp",		&ng_parse_int8_type	},	\
10153913Sarchie	  { "mru",		&ng_parse_int16_type	},	\
10253913Sarchie	  { "latency",		&ng_parse_int32_type	},	\
10353913Sarchie	  { "bandwidth",	&ng_parse_int32_type	},	\
10453913Sarchie	  { NULL },						\
10553913Sarchie	}							\
10653913Sarchie}
10753913Sarchie
10852639Sarchie/* Node config structure */
10952639Sarchiestruct ng_ppp_node_config {
11052639Sarchie	u_int16_t	mrru;			/* multilink peer MRRU */
11152639Sarchie	u_char		enableMultilink;	/* enable multilink */
11252639Sarchie	u_char		recvShortSeq;		/* recv multilink short seq # */
11352639Sarchie	u_char		xmitShortSeq;		/* xmit multilink short seq # */
11452639Sarchie	u_char		enableRoundRobin;	/* xmit whole packets */
11552639Sarchie	u_char		enableIP;		/* enable IP data flow */
11652639Sarchie	u_char		enableAtalk;		/* enable AppleTalk data flow */
11752639Sarchie	u_char		enableIPX;		/* enable IPX data flow */
11852639Sarchie	u_char		enableCompression;	/* enable PPP compression */
11952639Sarchie	u_char		enableDecompression;	/* enable PPP decompression */
12052639Sarchie	u_char		enableEncryption;	/* enable PPP encryption */
12152639Sarchie	u_char		enableDecryption;	/* enable PPP decryption */
12252639Sarchie	u_char		enableVJCompression;	/* enable VJ compression */
12352639Sarchie	u_char		enableVJDecompression;	/* enable VJ decompression */
12452639Sarchie	struct ng_ppp_link_config		/* per link config params */
12552639Sarchie			links[NG_PPP_MAX_LINKS];
12652639Sarchie};
12752419Sjulian
12853913Sarchie/* Keep this in sync with the above structure definition */
12953913Sarchie#define NG_PPP_CONFIG_TYPE_INFO(arytype)	{		\
13053913Sarchie	{							\
13153913Sarchie	  { "mrru",		&ng_parse_int16_type	},	\
13253913Sarchie	  { "multilink",	&ng_parse_int8_type	},	\
13353913Sarchie	  { "recvShortSeq",	&ng_parse_int8_type	},	\
13453913Sarchie	  { "xmitShortSeq",	&ng_parse_int8_type	},	\
13553913Sarchie	  { "roundRobin",	&ng_parse_int8_type	},	\
13653913Sarchie	  { "ip",		&ng_parse_int8_type	},	\
13753913Sarchie	  { "appletalk",	&ng_parse_int8_type	},	\
13853913Sarchie	  { "ipx",		&ng_parse_int8_type	},	\
13953913Sarchie	  { "comp",		&ng_parse_int8_type	},	\
14053913Sarchie	  { "decomp",		&ng_parse_int8_type	},	\
14153913Sarchie	  { "encryption",	&ng_parse_int8_type	},	\
14253913Sarchie	  { "decryption",	&ng_parse_int8_type	},	\
14353913Sarchie	  { "vjcomp",		&ng_parse_int8_type	},	\
14453913Sarchie	  { "vjdecomp",		&ng_parse_int8_type	},	\
14553913Sarchie	  { "links",		(arytype)		},	\
14653913Sarchie	  { NULL },						\
14753913Sarchie	}							\
14853913Sarchie}
14953913Sarchie
15052639Sarchie/* Statistics struct for a link (or the bundle if NG_PPP_BUNDLE_LINKNUM) */
15152639Sarchiestruct ng_ppp_link_stat {
15252639Sarchie	u_int32_t xmitFrames;		/* xmit frames on link */
15352639Sarchie	u_int32_t xmitOctets;		/* xmit octets on link */
15452639Sarchie	u_int32_t recvFrames;		/* recv frames on link */
15552639Sarchie	u_int32_t recvOctets;		/* recv octets on link */
15652639Sarchie	u_int32_t badProtos;		/* frames rec'd with bogus protocol */
15752639Sarchie	u_int32_t dupFragments;		/* MP frames with duplicate seq # */
15852639Sarchie};
15952639Sarchie
16053913Sarchie/* Keep this in sync with the above structure definition */
16153913Sarchie#define NG_PPP_STATS_TYPE_INFO	{				\
16253913Sarchie	{							\
16353913Sarchie	  { "xmitFrames",	&ng_parse_int32_type	},	\
16453913Sarchie	  { "xmitOctets",	&ng_parse_int32_type	},	\
16553913Sarchie	  { "recvFrames",	&ng_parse_int32_type	},	\
16653913Sarchie	  { "recvOctets",	&ng_parse_int32_type	},	\
16753913Sarchie	  { "badProtos",	&ng_parse_int32_type	},	\
16853913Sarchie	  { "dupFragments",	&ng_parse_int32_type	},	\
16953913Sarchie	  { NULL },						\
17053913Sarchie	}							\
17153913Sarchie}
17253913Sarchie
17352419Sjulian#endif /* _NETGRAPH_PPP_H_ */
174