xref: /freebsd/sys/netgraph/ng_ppp.h (revision f0184ff8e3b84a1c7273492d8854cfaa012060b5)
14cf49a43SJulian Elischer 
24cf49a43SJulian Elischer /*
34cf49a43SJulian Elischer  * ng_ppp.h
44cf49a43SJulian Elischer  *
5a9b3dca5SArchie Cobbs  * Copyright (c) 1996-2000 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  *
376f16db81SArchie Cobbs  * Author: Archie Cobbs <archie@freebsd.org>
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"
486f16db81SArchie Cobbs #define NGM_PPP_COOKIE		940897795
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 */
73a9b3dca5SArchie Cobbs #define NG_PPP_HOOK_IPV6	"ipv6"		/* IPv6 packet data */
743949bee8SArchie Cobbs 
753949bee8SArchie Cobbs #define NG_PPP_HOOK_LINK_PREFIX	"link"		/* append decimal link number */
764cf49a43SJulian Elischer 
774cf49a43SJulian Elischer /* Netgraph commands */
784cf49a43SJulian Elischer enum {
79a9b3dca5SArchie Cobbs 	NGM_PPP_SET_CONFIG = 1,		/* takes struct ng_ppp_node_conf */
80a9b3dca5SArchie Cobbs 	NGM_PPP_GET_CONFIG,		/* returns ng_ppp_node_conf */
816f16db81SArchie Cobbs 	NGM_PPP_GET_MP_STATE,		/* returns ng_ppp_mp_state */
823949bee8SArchie Cobbs 	NGM_PPP_GET_LINK_STATS,		/* takes link #, returns stats struct */
833949bee8SArchie Cobbs 	NGM_PPP_CLR_LINK_STATS,		/* takes link #, clears link stats */
84e149c4e2SArchie Cobbs 	NGM_PPP_GETCLR_LINK_STATS,	/* takes link #, returns & clrs stats */
854cf49a43SJulian Elischer };
864cf49a43SJulian Elischer 
876f16db81SArchie Cobbs /* Multi-link sequence number state (for debugging) */
886f16db81SArchie Cobbs struct ng_ppp_mp_state {
896f16db81SArchie Cobbs 	int32_t		rseq[NG_PPP_MAX_LINKS];	/* highest rec'd MP seq # */
906f16db81SArchie Cobbs 	int32_t		mseq;			/* min rseq[i] */
916f16db81SArchie Cobbs 	int32_t		xseq;			/* next xmit MP seq # */
926f16db81SArchie Cobbs };
936f16db81SArchie Cobbs 
946f16db81SArchie Cobbs /* Keep this in sync with the above structure definition */
956f16db81SArchie Cobbs #define NG_PPP_MP_STATE_TYPE_INFO(atype)	{		\
966f16db81SArchie Cobbs 	  { "rseq",	(atype)			},		\
976f16db81SArchie Cobbs 	  { "mseq",	&ng_parse_hint32_type	},		\
986f16db81SArchie Cobbs 	  { "xseq",	&ng_parse_hint32_type	},		\
99f0184ff8SArchie Cobbs 	  { NULL }						\
1006f16db81SArchie Cobbs }
1016f16db81SArchie Cobbs 
1023949bee8SArchie Cobbs /* Per-link config structure */
103a9b3dca5SArchie Cobbs struct ng_ppp_link_conf {
1043949bee8SArchie Cobbs 	u_char		enableLink;	/* enable this link */
1053949bee8SArchie Cobbs 	u_char		enableProtoComp;/* enable protocol field compression */
106d690a6e7SArchie Cobbs 	u_char		enableACFComp;	/* enable addr/ctrl field compression */
1073949bee8SArchie Cobbs 	u_int16_t	mru;		/* peer MRU */
1083949bee8SArchie Cobbs 	u_int32_t	latency;	/* link latency (in milliseconds) */
1093949bee8SArchie Cobbs 	u_int32_t	bandwidth;	/* link bandwidth (in bytes/second) */
1104cf49a43SJulian Elischer };
1114cf49a43SJulian Elischer 
112f8307e12SArchie Cobbs /* Keep this in sync with the above structure definition */
113f8307e12SArchie Cobbs #define NG_PPP_LINK_TYPE_INFO	{				\
11457b57be3SArchie Cobbs 	  { "enableLink",	&ng_parse_uint8_type	},	\
11557b57be3SArchie Cobbs 	  { "enableProtoComp",	&ng_parse_uint8_type	},	\
11657b57be3SArchie Cobbs 	  { "enableACFComp",	&ng_parse_uint8_type	},	\
11757b57be3SArchie Cobbs 	  { "mru",		&ng_parse_uint16_type	},	\
11857b57be3SArchie Cobbs 	  { "latency",		&ng_parse_uint32_type	},	\
11957b57be3SArchie Cobbs 	  { "bandwidth",	&ng_parse_uint32_type	},	\
120f0184ff8SArchie Cobbs 	  { NULL }						\
121f8307e12SArchie Cobbs }
122f8307e12SArchie Cobbs 
123a9b3dca5SArchie Cobbs /* Bundle config structure */
124a9b3dca5SArchie Cobbs struct ng_ppp_bund_conf {
1253949bee8SArchie Cobbs 	u_int16_t	mrru;			/* multilink peer MRRU */
1263949bee8SArchie Cobbs 	u_char		enableMultilink;	/* enable multilink */
1273949bee8SArchie Cobbs 	u_char		recvShortSeq;		/* recv multilink short seq # */
1283949bee8SArchie Cobbs 	u_char		xmitShortSeq;		/* xmit multilink short seq # */
1293949bee8SArchie Cobbs 	u_char		enableRoundRobin;	/* xmit whole packets */
1303949bee8SArchie Cobbs 	u_char		enableIP;		/* enable IP data flow */
131a9b3dca5SArchie Cobbs 	u_char		enableIPv6;		/* enable IPv6 data flow */
1323949bee8SArchie Cobbs 	u_char		enableAtalk;		/* enable AppleTalk data flow */
1333949bee8SArchie Cobbs 	u_char		enableIPX;		/* enable IPX data flow */
1343949bee8SArchie Cobbs 	u_char		enableCompression;	/* enable PPP compression */
1353949bee8SArchie Cobbs 	u_char		enableDecompression;	/* enable PPP decompression */
1363949bee8SArchie Cobbs 	u_char		enableEncryption;	/* enable PPP encryption */
1373949bee8SArchie Cobbs 	u_char		enableDecryption;	/* enable PPP decryption */
1383949bee8SArchie Cobbs 	u_char		enableVJCompression;	/* enable VJ compression */
1393949bee8SArchie Cobbs 	u_char		enableVJDecompression;	/* enable VJ decompression */
1403949bee8SArchie Cobbs };
1413949bee8SArchie Cobbs 
142f8307e12SArchie Cobbs /* Keep this in sync with the above structure definition */
143a9b3dca5SArchie Cobbs #define NG_PPP_BUND_TYPE_INFO	{					\
14457b57be3SArchie Cobbs 	  { "mrru",			&ng_parse_uint16_type	},	\
14557b57be3SArchie Cobbs 	  { "enableMultilink",		&ng_parse_uint8_type	},	\
14657b57be3SArchie Cobbs 	  { "recvShortSeq",		&ng_parse_uint8_type	},	\
14757b57be3SArchie Cobbs 	  { "xmitShortSeq",		&ng_parse_uint8_type	},	\
14857b57be3SArchie Cobbs 	  { "enableRoundRobin",		&ng_parse_uint8_type	},	\
14957b57be3SArchie Cobbs 	  { "enableIP",			&ng_parse_uint8_type	},	\
15057b57be3SArchie Cobbs 	  { "enableIPv6",		&ng_parse_uint8_type	},	\
15157b57be3SArchie Cobbs 	  { "enableAtalk",		&ng_parse_uint8_type	},	\
15257b57be3SArchie Cobbs 	  { "enableIPX",		&ng_parse_uint8_type	},	\
15357b57be3SArchie Cobbs 	  { "enableCompression",	&ng_parse_uint8_type	},	\
15457b57be3SArchie Cobbs 	  { "enableDecompression",	&ng_parse_uint8_type	},	\
15557b57be3SArchie Cobbs 	  { "enableEncryption",		&ng_parse_uint8_type	},	\
15657b57be3SArchie Cobbs 	  { "enableDecryption",		&ng_parse_uint8_type	},	\
15757b57be3SArchie Cobbs 	  { "enableVJCompression",	&ng_parse_uint8_type	},	\
15857b57be3SArchie Cobbs 	  { "enableVJDecompression",	&ng_parse_uint8_type	},	\
159a9b3dca5SArchie Cobbs 	  { NULL }							\
160a9b3dca5SArchie Cobbs }
161a9b3dca5SArchie Cobbs 
162a9b3dca5SArchie Cobbs /* Total node config structure */
163a9b3dca5SArchie Cobbs struct ng_ppp_node_conf {
164a9b3dca5SArchie Cobbs 	struct ng_ppp_bund_conf	bund;
165a9b3dca5SArchie Cobbs 	struct ng_ppp_link_conf	links[NG_PPP_MAX_LINKS];
166a9b3dca5SArchie Cobbs };
167a9b3dca5SArchie Cobbs 
168a9b3dca5SArchie Cobbs /* Keep this in sync with the above structure definition */
169a9b3dca5SArchie Cobbs #define NG_PPP_CONFIG_TYPE_INFO(bctype, arytype)	{	\
170a9b3dca5SArchie Cobbs 	  { "bund",		(bctype)	},		\
171f8307e12SArchie Cobbs 	  { "links",		(arytype)	},		\
172a9b3dca5SArchie Cobbs 	  { NULL }						\
173f8307e12SArchie Cobbs }
174f8307e12SArchie Cobbs 
1753949bee8SArchie Cobbs /* Statistics struct for a link (or the bundle if NG_PPP_BUNDLE_LINKNUM) */
1763949bee8SArchie Cobbs struct ng_ppp_link_stat {
1773949bee8SArchie Cobbs 	u_int32_t xmitFrames;		/* xmit frames on link */
1783949bee8SArchie Cobbs 	u_int32_t xmitOctets;		/* xmit octets on link */
1793949bee8SArchie Cobbs 	u_int32_t recvFrames;		/* recv frames on link */
1803949bee8SArchie Cobbs 	u_int32_t recvOctets;		/* recv octets on link */
1813949bee8SArchie Cobbs 	u_int32_t badProtos;		/* frames rec'd with bogus protocol */
182a9b3dca5SArchie Cobbs 	u_int32_t runts;		/* Too short MP fragments */
1833949bee8SArchie Cobbs 	u_int32_t dupFragments;		/* MP frames with duplicate seq # */
184a9b3dca5SArchie Cobbs 	u_int32_t dropFragments;	/* MP fragments we had to drop */
1853949bee8SArchie Cobbs };
1864cf49a43SJulian Elischer 
187f8307e12SArchie Cobbs /* Keep this in sync with the above structure definition */
188f8307e12SArchie Cobbs #define NG_PPP_STATS_TYPE_INFO	{				\
18957b57be3SArchie Cobbs 	  { "xmitFrames",	&ng_parse_uint32_type	},	\
19057b57be3SArchie Cobbs 	  { "xmitOctets",	&ng_parse_uint32_type	},	\
19157b57be3SArchie Cobbs 	  { "recvFrames",	&ng_parse_uint32_type	},	\
19257b57be3SArchie Cobbs 	  { "recvOctets",	&ng_parse_uint32_type	},	\
19357b57be3SArchie Cobbs 	  { "badProtos",	&ng_parse_uint32_type	},	\
19457b57be3SArchie Cobbs 	  { "runts",		&ng_parse_uint32_type	},	\
19557b57be3SArchie Cobbs 	  { "dupFragments",	&ng_parse_uint32_type	},	\
19657b57be3SArchie Cobbs 	  { "dropFragments",	&ng_parse_uint32_type	},	\
197a9b3dca5SArchie Cobbs 	  { NULL }						\
198f8307e12SArchie Cobbs }
199f8307e12SArchie Cobbs 
2004cf49a43SJulian Elischer #endif /* _NETGRAPH_PPP_H_ */
201