xref: /freebsd/sys/netgraph/ng_ppp.h (revision a9b3dca54dc95b6499f91a194cdee05608c2dc6b)
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  *
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"
48a9b3dca5SArchie Cobbs #define NGM_PPP_COOKIE		940897794
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 */
813949bee8SArchie Cobbs 	NGM_PPP_GET_LINK_STATS,		/* takes link #, returns stats struct */
823949bee8SArchie Cobbs 	NGM_PPP_CLR_LINK_STATS,		/* takes link #, clears link stats */
83e149c4e2SArchie Cobbs 	NGM_PPP_GETCLR_LINK_STATS,	/* takes link #, returns & clrs stats */
844cf49a43SJulian Elischer };
854cf49a43SJulian Elischer 
863949bee8SArchie Cobbs /* Per-link config structure */
87a9b3dca5SArchie Cobbs struct ng_ppp_link_conf {
883949bee8SArchie Cobbs 	u_char		enableLink;	/* enable this link */
893949bee8SArchie Cobbs 	u_char		enableProtoComp;/* enable protocol field compression */
90d690a6e7SArchie Cobbs 	u_char		enableACFComp;	/* enable addr/ctrl field compression */
913949bee8SArchie Cobbs 	u_int16_t	mru;		/* peer MRU */
923949bee8SArchie Cobbs 	u_int32_t	latency;	/* link latency (in milliseconds) */
933949bee8SArchie Cobbs 	u_int32_t	bandwidth;	/* link bandwidth (in bytes/second) */
944cf49a43SJulian Elischer };
954cf49a43SJulian Elischer 
96f8307e12SArchie Cobbs /* Keep this in sync with the above structure definition */
97f8307e12SArchie Cobbs #define NG_PPP_LINK_TYPE_INFO	{				\
98f8307e12SArchie Cobbs 	{							\
99a9b3dca5SArchie Cobbs 	  { "enableLink",	&ng_parse_int8_type	},	\
100a9b3dca5SArchie Cobbs 	  { "enableProtoComp",	&ng_parse_int8_type	},	\
101a9b3dca5SArchie Cobbs 	  { "enableACFComp",	&ng_parse_int8_type	},	\
102f8307e12SArchie Cobbs 	  { "mru",		&ng_parse_int16_type	},	\
103f8307e12SArchie Cobbs 	  { "latency",		&ng_parse_int32_type	},	\
104f8307e12SArchie Cobbs 	  { "bandwidth",	&ng_parse_int32_type	},	\
105f8307e12SArchie Cobbs 	  { NULL },						\
106f8307e12SArchie Cobbs 	}							\
107f8307e12SArchie Cobbs }
108f8307e12SArchie Cobbs 
109a9b3dca5SArchie Cobbs /* Bundle config structure */
110a9b3dca5SArchie Cobbs struct ng_ppp_bund_conf {
1113949bee8SArchie Cobbs 	u_int16_t	mrru;			/* multilink peer MRRU */
1123949bee8SArchie Cobbs 	u_char		enableMultilink;	/* enable multilink */
1133949bee8SArchie Cobbs 	u_char		recvShortSeq;		/* recv multilink short seq # */
1143949bee8SArchie Cobbs 	u_char		xmitShortSeq;		/* xmit multilink short seq # */
1153949bee8SArchie Cobbs 	u_char		enableRoundRobin;	/* xmit whole packets */
1163949bee8SArchie Cobbs 	u_char		enableIP;		/* enable IP data flow */
117a9b3dca5SArchie Cobbs 	u_char		enableIPv6;		/* enable IPv6 data flow */
1183949bee8SArchie Cobbs 	u_char		enableAtalk;		/* enable AppleTalk data flow */
1193949bee8SArchie Cobbs 	u_char		enableIPX;		/* enable IPX data flow */
1203949bee8SArchie Cobbs 	u_char		enableCompression;	/* enable PPP compression */
1213949bee8SArchie Cobbs 	u_char		enableDecompression;	/* enable PPP decompression */
1223949bee8SArchie Cobbs 	u_char		enableEncryption;	/* enable PPP encryption */
1233949bee8SArchie Cobbs 	u_char		enableDecryption;	/* enable PPP decryption */
1243949bee8SArchie Cobbs 	u_char		enableVJCompression;	/* enable VJ compression */
1253949bee8SArchie Cobbs 	u_char		enableVJDecompression;	/* enable VJ decompression */
1263949bee8SArchie Cobbs };
1273949bee8SArchie Cobbs 
128f8307e12SArchie Cobbs /* Keep this in sync with the above structure definition */
129a9b3dca5SArchie Cobbs #define NG_PPP_BUND_TYPE_INFO	{					\
130f8307e12SArchie Cobbs 	{								\
131f8307e12SArchie Cobbs 	  { "mrru",			&ng_parse_int16_type	},	\
132a9b3dca5SArchie Cobbs 	  { "enableMultilink",		&ng_parse_int8_type	},	\
133f8307e12SArchie Cobbs 	  { "recvShortSeq",		&ng_parse_int8_type	},	\
134f8307e12SArchie Cobbs 	  { "xmitShortSeq",		&ng_parse_int8_type	},	\
135a9b3dca5SArchie Cobbs 	  { "enableRoundRobin",		&ng_parse_int8_type	},	\
136a9b3dca5SArchie Cobbs 	  { "enableIP",			&ng_parse_int8_type	},	\
137a9b3dca5SArchie Cobbs 	  { "enableIPv6",		&ng_parse_int8_type	},	\
138a9b3dca5SArchie Cobbs 	  { "enableAtalk",		&ng_parse_int8_type	},	\
139a9b3dca5SArchie Cobbs 	  { "enableIPX",		&ng_parse_int8_type	},	\
140a9b3dca5SArchie Cobbs 	  { "enableCompression",	&ng_parse_int8_type	},	\
141a9b3dca5SArchie Cobbs 	  { "enableDecompression",	&ng_parse_int8_type	},	\
142a9b3dca5SArchie Cobbs 	  { "enableEncryption",		&ng_parse_int8_type	},	\
143a9b3dca5SArchie Cobbs 	  { "enableDecryption",		&ng_parse_int8_type	},	\
144a9b3dca5SArchie Cobbs 	  { "enableVJCompression",	&ng_parse_int8_type	},	\
145a9b3dca5SArchie Cobbs 	  { "enableVJDecompression",	&ng_parse_int8_type	},	\
146a9b3dca5SArchie Cobbs 	  { NULL }							\
147a9b3dca5SArchie Cobbs 	}								\
148a9b3dca5SArchie Cobbs }
149a9b3dca5SArchie Cobbs 
150a9b3dca5SArchie Cobbs /* Total node config structure */
151a9b3dca5SArchie Cobbs struct ng_ppp_node_conf {
152a9b3dca5SArchie Cobbs 	struct ng_ppp_bund_conf	bund;
153a9b3dca5SArchie Cobbs 	struct ng_ppp_link_conf	links[NG_PPP_MAX_LINKS];
154a9b3dca5SArchie Cobbs };
155a9b3dca5SArchie Cobbs 
156a9b3dca5SArchie Cobbs /* Keep this in sync with the above structure definition */
157a9b3dca5SArchie Cobbs #define NG_PPP_CONFIG_TYPE_INFO(bctype, arytype)	{	\
158a9b3dca5SArchie Cobbs 	{							\
159a9b3dca5SArchie Cobbs 	  { "bund",		(bctype)	},		\
160f8307e12SArchie Cobbs 	  { "links",		(arytype)	},		\
161a9b3dca5SArchie Cobbs 	  { NULL }						\
162f8307e12SArchie Cobbs 	}							\
163f8307e12SArchie Cobbs }
164f8307e12SArchie Cobbs 
1653949bee8SArchie Cobbs /* Statistics struct for a link (or the bundle if NG_PPP_BUNDLE_LINKNUM) */
1663949bee8SArchie Cobbs struct ng_ppp_link_stat {
1673949bee8SArchie Cobbs 	u_int32_t xmitFrames;		/* xmit frames on link */
1683949bee8SArchie Cobbs 	u_int32_t xmitOctets;		/* xmit octets on link */
1693949bee8SArchie Cobbs 	u_int32_t recvFrames;		/* recv frames on link */
1703949bee8SArchie Cobbs 	u_int32_t recvOctets;		/* recv octets on link */
1713949bee8SArchie Cobbs 	u_int32_t badProtos;		/* frames rec'd with bogus protocol */
172a9b3dca5SArchie Cobbs 	u_int32_t runts;		/* Too short MP fragments */
1733949bee8SArchie Cobbs 	u_int32_t dupFragments;		/* MP frames with duplicate seq # */
174a9b3dca5SArchie Cobbs 	u_int32_t dropFragments;	/* MP fragments we had to drop */
1753949bee8SArchie Cobbs };
1764cf49a43SJulian Elischer 
177f8307e12SArchie Cobbs /* Keep this in sync with the above structure definition */
178f8307e12SArchie Cobbs #define NG_PPP_STATS_TYPE_INFO	{				\
179f8307e12SArchie Cobbs 	{							\
180f8307e12SArchie Cobbs 	  { "xmitFrames",	&ng_parse_int32_type	},	\
181f8307e12SArchie Cobbs 	  { "xmitOctets",	&ng_parse_int32_type	},	\
182f8307e12SArchie Cobbs 	  { "recvFrames",	&ng_parse_int32_type	},	\
183f8307e12SArchie Cobbs 	  { "recvOctets",	&ng_parse_int32_type	},	\
184f8307e12SArchie Cobbs 	  { "badProtos",	&ng_parse_int32_type	},	\
185a9b3dca5SArchie Cobbs 	  { "runts",		&ng_parse_int32_type	},	\
186f8307e12SArchie Cobbs 	  { "dupFragments",	&ng_parse_int32_type	},	\
187a9b3dca5SArchie Cobbs 	  { "dropFragments",	&ng_parse_int32_type	},	\
188a9b3dca5SArchie Cobbs 	  { NULL }						\
189f8307e12SArchie Cobbs 	}							\
190f8307e12SArchie Cobbs }
191f8307e12SArchie Cobbs 
1924cf49a43SJulian Elischer #endif /* _NETGRAPH_PPP_H_ */
193