xref: /freebsd/sys/netgraph/ng_ppp.h (revision f8307e1233657707bc582110f07373c96d91943b)
14cf49a43SJulian Elischer 
24cf49a43SJulian Elischer /*
34cf49a43SJulian Elischer  * ng_ppp.h
44cf49a43SJulian Elischer  *
54cf49a43SJulian Elischer  * Copyright (c) 1996-1999 Whistle Communications, Inc.
64cf49a43SJulian Elischer  * All rights reserved.
74cf49a43SJulian Elischer  *
84cf49a43SJulian Elischer  * Subject to the following obligations and disclaimer of warranty, use and
94cf49a43SJulian Elischer  * redistribution of this software, in source or object code forms, with or
104cf49a43SJulian Elischer  * without modifications are expressly permitted by Whistle Communications;
114cf49a43SJulian Elischer  * provided, however, that:
124cf49a43SJulian Elischer  * 1. Any and all reproductions of the source or object code must include the
134cf49a43SJulian Elischer  *    copyright notice above and the following disclaimer of warranties; and
144cf49a43SJulian Elischer  * 2. No rights are granted, in any manner or form, to use Whistle
154cf49a43SJulian Elischer  *    Communications, Inc. trademarks, including the mark "WHISTLE
164cf49a43SJulian Elischer  *    COMMUNICATIONS" on advertising, endorsements, or otherwise except as
174cf49a43SJulian Elischer  *    such appears in the above copyright notice or in the software.
184cf49a43SJulian Elischer  *
194cf49a43SJulian Elischer  * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
204cf49a43SJulian Elischer  * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
214cf49a43SJulian Elischer  * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
224cf49a43SJulian Elischer  * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
234cf49a43SJulian Elischer  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
244cf49a43SJulian Elischer  * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
254cf49a43SJulian Elischer  * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
264cf49a43SJulian Elischer  * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
274cf49a43SJulian Elischer  * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
284cf49a43SJulian Elischer  * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
294cf49a43SJulian Elischer  * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
304cf49a43SJulian Elischer  * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
314cf49a43SJulian Elischer  * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
324cf49a43SJulian Elischer  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
334cf49a43SJulian Elischer  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
344cf49a43SJulian Elischer  * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
354cf49a43SJulian Elischer  * OF SUCH DAMAGE.
364cf49a43SJulian Elischer  *
374cf49a43SJulian Elischer  * Author: Archie Cobbs <archie@whistle.com>
384cf49a43SJulian Elischer  *
394cf49a43SJulian Elischer  * $FreeBSD$
404cf49a43SJulian Elischer  * $Whistle: ng_ppp.h,v 1.8 1999/01/25 02:40:02 archie Exp $
414cf49a43SJulian Elischer  */
424cf49a43SJulian Elischer 
434cf49a43SJulian Elischer #ifndef _NETGRAPH_PPP_H_
444cf49a43SJulian Elischer #define _NETGRAPH_PPP_H_
454cf49a43SJulian Elischer 
464cf49a43SJulian Elischer /* Node type name and magic cookie */
474cf49a43SJulian Elischer #define NG_PPP_NODE_TYPE	"ppp"
48d690a6e7SArchie Cobbs #define NGM_PPP_COOKIE		940897793
493949bee8SArchie Cobbs 
503949bee8SArchie Cobbs /* Maximum number of supported links */
513949bee8SArchie Cobbs #define NG_PPP_MAX_LINKS	16
523949bee8SArchie Cobbs 
533949bee8SArchie Cobbs /* Pseudo-link number representing the multi-link bundle */
543949bee8SArchie Cobbs #define NG_PPP_BUNDLE_LINKNUM	0xffff
553949bee8SArchie Cobbs 
563949bee8SArchie Cobbs /* Max allowable link latency (miliseconds) and bandwidth (bytes/second/10) */
573949bee8SArchie Cobbs #define NG_PPP_MAX_LATENCY	1000		/* 1 second */
583949bee8SArchie Cobbs #define NG_PPP_MAX_BANDWIDTH	125000		/* 10 Mbits / second */
594cf49a43SJulian Elischer 
604cf49a43SJulian Elischer /* Hook names */
613949bee8SArchie Cobbs #define NG_PPP_HOOK_BYPASS	"bypass"	/* unknown protocols */
623949bee8SArchie Cobbs #define NG_PPP_HOOK_COMPRESS	"compress"	/* outgoing compression */
633949bee8SArchie Cobbs #define NG_PPP_HOOK_DECOMPRESS	"decompress"	/* incoming decompression */
643949bee8SArchie Cobbs #define NG_PPP_HOOK_ENCRYPT	"encrypt"	/* outgoing encryption */
653949bee8SArchie Cobbs #define NG_PPP_HOOK_DECRYPT	"decrypt"	/* incoming decryption */
663949bee8SArchie Cobbs #define NG_PPP_HOOK_VJC_IP	"vjc_ip"	/* VJC raw IP */
673949bee8SArchie Cobbs #define NG_PPP_HOOK_VJC_COMP	"vjc_vjcomp"	/* VJC compressed TCP */
683949bee8SArchie Cobbs #define NG_PPP_HOOK_VJC_UNCOMP	"vjc_vjuncomp"	/* VJC uncompressed TCP */
693949bee8SArchie Cobbs #define NG_PPP_HOOK_VJC_VJIP	"vjc_vjip"	/* VJC uncompressed IP */
703949bee8SArchie Cobbs #define NG_PPP_HOOK_INET	"inet"		/* IP packet data */
713949bee8SArchie Cobbs #define NG_PPP_HOOK_ATALK	"atalk"		/* AppleTalk packet data */
723949bee8SArchie Cobbs #define NG_PPP_HOOK_IPX		"ipx"		/* IPX packet data */
733949bee8SArchie Cobbs 
743949bee8SArchie Cobbs #define NG_PPP_HOOK_LINK_PREFIX	"link"		/* append decimal link number */
754cf49a43SJulian Elischer 
764cf49a43SJulian Elischer /* Netgraph commands */
774cf49a43SJulian Elischer enum {
783949bee8SArchie Cobbs 	NGM_PPP_SET_CONFIG = 1,		/* takes struct ng_ppp_bundle_config */
793949bee8SArchie Cobbs 	NGM_PPP_GET_CONFIG,		/* returns ng_ppp_bundle_config */
803949bee8SArchie Cobbs 	NGM_PPP_GET_LINK_STATS,		/* takes link #, returns stats struct */
813949bee8SArchie Cobbs 	NGM_PPP_CLR_LINK_STATS,		/* takes link #, clears link stats */
82e149c4e2SArchie Cobbs 	NGM_PPP_GETCLR_LINK_STATS,	/* takes link #, returns & clrs stats */
834cf49a43SJulian Elischer };
844cf49a43SJulian Elischer 
853949bee8SArchie Cobbs /* Per-link config structure */
863949bee8SArchie Cobbs struct ng_ppp_link_config {
873949bee8SArchie Cobbs 	u_char		enableLink;	/* enable this link */
883949bee8SArchie Cobbs 	u_char		enableProtoComp;/* enable protocol field compression */
89d690a6e7SArchie Cobbs 	u_char		enableACFComp;	/* enable addr/ctrl field compression */
903949bee8SArchie Cobbs 	u_int16_t	mru;		/* peer MRU */
913949bee8SArchie Cobbs 	u_int32_t	latency;	/* link latency (in milliseconds) */
923949bee8SArchie Cobbs 	u_int32_t	bandwidth;	/* link bandwidth (in bytes/second) */
934cf49a43SJulian Elischer };
944cf49a43SJulian Elischer 
95f8307e12SArchie Cobbs /* Keep this in sync with the above structure definition */
96f8307e12SArchie Cobbs #define NG_PPP_LINK_TYPE_INFO	{				\
97f8307e12SArchie Cobbs 	{							\
98f8307e12SArchie Cobbs 	  { "enable",		&ng_parse_int8_type	},	\
99f8307e12SArchie Cobbs 	  { "protocomp",	&ng_parse_int8_type	},	\
100f8307e12SArchie Cobbs 	  { "acfcomp",		&ng_parse_int8_type	},	\
101f8307e12SArchie Cobbs 	  { "mru",		&ng_parse_int16_type	},	\
102f8307e12SArchie Cobbs 	  { "latency",		&ng_parse_int32_type	},	\
103f8307e12SArchie Cobbs 	  { "bandwidth",	&ng_parse_int32_type	},	\
104f8307e12SArchie Cobbs 	  { NULL },						\
105f8307e12SArchie Cobbs 	}							\
106f8307e12SArchie Cobbs }
107f8307e12SArchie Cobbs 
1083949bee8SArchie Cobbs /* Node config structure */
1093949bee8SArchie Cobbs struct ng_ppp_node_config {
1103949bee8SArchie Cobbs 	u_int16_t	mrru;			/* multilink peer MRRU */
1113949bee8SArchie Cobbs 	u_char		enableMultilink;	/* enable multilink */
1123949bee8SArchie Cobbs 	u_char		recvShortSeq;		/* recv multilink short seq # */
1133949bee8SArchie Cobbs 	u_char		xmitShortSeq;		/* xmit multilink short seq # */
1143949bee8SArchie Cobbs 	u_char		enableRoundRobin;	/* xmit whole packets */
1153949bee8SArchie Cobbs 	u_char		enableIP;		/* enable IP data flow */
1163949bee8SArchie Cobbs 	u_char		enableAtalk;		/* enable AppleTalk data flow */
1173949bee8SArchie Cobbs 	u_char		enableIPX;		/* enable IPX data flow */
1183949bee8SArchie Cobbs 	u_char		enableCompression;	/* enable PPP compression */
1193949bee8SArchie Cobbs 	u_char		enableDecompression;	/* enable PPP decompression */
1203949bee8SArchie Cobbs 	u_char		enableEncryption;	/* enable PPP encryption */
1213949bee8SArchie Cobbs 	u_char		enableDecryption;	/* enable PPP decryption */
1223949bee8SArchie Cobbs 	u_char		enableVJCompression;	/* enable VJ compression */
1233949bee8SArchie Cobbs 	u_char		enableVJDecompression;	/* enable VJ decompression */
1243949bee8SArchie Cobbs 	struct ng_ppp_link_config		/* per link config params */
1253949bee8SArchie Cobbs 			links[NG_PPP_MAX_LINKS];
1263949bee8SArchie Cobbs };
1273949bee8SArchie Cobbs 
128f8307e12SArchie Cobbs /* Keep this in sync with the above structure definition */
129f8307e12SArchie Cobbs #define NG_PPP_CONFIG_TYPE_INFO(arytype)	{		\
130f8307e12SArchie Cobbs 	{							\
131f8307e12SArchie Cobbs 	  { "mrru",		&ng_parse_int16_type	},	\
132f8307e12SArchie Cobbs 	  { "multilink",	&ng_parse_int8_type	},	\
133f8307e12SArchie Cobbs 	  { "recvShortSeq",	&ng_parse_int8_type	},	\
134f8307e12SArchie Cobbs 	  { "xmitShortSeq",	&ng_parse_int8_type	},	\
135f8307e12SArchie Cobbs 	  { "roundRobin",	&ng_parse_int8_type	},	\
136f8307e12SArchie Cobbs 	  { "ip",		&ng_parse_int8_type	},	\
137f8307e12SArchie Cobbs 	  { "appletalk",	&ng_parse_int8_type	},	\
138f8307e12SArchie Cobbs 	  { "ipx",		&ng_parse_int8_type	},	\
139f8307e12SArchie Cobbs 	  { "comp",		&ng_parse_int8_type	},	\
140f8307e12SArchie Cobbs 	  { "decomp",		&ng_parse_int8_type	},	\
141f8307e12SArchie Cobbs 	  { "encryption",	&ng_parse_int8_type	},	\
142f8307e12SArchie Cobbs 	  { "decryption",	&ng_parse_int8_type	},	\
143f8307e12SArchie Cobbs 	  { "vjcomp",		&ng_parse_int8_type	},	\
144f8307e12SArchie Cobbs 	  { "vjdecomp",		&ng_parse_int8_type	},	\
145f8307e12SArchie Cobbs 	  { "links",		(arytype)		},	\
146f8307e12SArchie Cobbs 	  { NULL },						\
147f8307e12SArchie Cobbs 	}							\
148f8307e12SArchie Cobbs }
149f8307e12SArchie Cobbs 
1503949bee8SArchie Cobbs /* Statistics struct for a link (or the bundle if NG_PPP_BUNDLE_LINKNUM) */
1513949bee8SArchie Cobbs struct ng_ppp_link_stat {
1523949bee8SArchie Cobbs 	u_int32_t xmitFrames;		/* xmit frames on link */
1533949bee8SArchie Cobbs 	u_int32_t xmitOctets;		/* xmit octets on link */
1543949bee8SArchie Cobbs 	u_int32_t recvFrames;		/* recv frames on link */
1553949bee8SArchie Cobbs 	u_int32_t recvOctets;		/* recv octets on link */
1563949bee8SArchie Cobbs 	u_int32_t badProtos;		/* frames rec'd with bogus protocol */
1573949bee8SArchie Cobbs 	u_int32_t dupFragments;		/* MP frames with duplicate seq # */
1583949bee8SArchie Cobbs };
1594cf49a43SJulian Elischer 
160f8307e12SArchie Cobbs /* Keep this in sync with the above structure definition */
161f8307e12SArchie Cobbs #define NG_PPP_STATS_TYPE_INFO	{				\
162f8307e12SArchie Cobbs 	{							\
163f8307e12SArchie Cobbs 	  { "xmitFrames",	&ng_parse_int32_type	},	\
164f8307e12SArchie Cobbs 	  { "xmitOctets",	&ng_parse_int32_type	},	\
165f8307e12SArchie Cobbs 	  { "recvFrames",	&ng_parse_int32_type	},	\
166f8307e12SArchie Cobbs 	  { "recvOctets",	&ng_parse_int32_type	},	\
167f8307e12SArchie Cobbs 	  { "badProtos",	&ng_parse_int32_type	},	\
168f8307e12SArchie Cobbs 	  { "dupFragments",	&ng_parse_int32_type	},	\
169f8307e12SArchie Cobbs 	  { NULL },						\
170f8307e12SArchie Cobbs 	}							\
171f8307e12SArchie Cobbs }
172f8307e12SArchie Cobbs 
1734cf49a43SJulian Elischer #endif /* _NETGRAPH_PPP_H_ */
174