xref: /freebsd/sys/netgraph/ng_ppp.h (revision e149c4e211177ef1b1e24e51dafebe3114ac6d16)
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"
483949bee8SArchie Cobbs #define NGM_PPP_COOKIE		940897792
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 */
893949bee8SArchie Cobbs 	u_int16_t	mru;		/* peer MRU */
903949bee8SArchie Cobbs 	u_int32_t	latency;	/* link latency (in milliseconds) */
913949bee8SArchie Cobbs 	u_int32_t	bandwidth;	/* link bandwidth (in bytes/second) */
924cf49a43SJulian Elischer };
934cf49a43SJulian Elischer 
943949bee8SArchie Cobbs /* Node config structure */
953949bee8SArchie Cobbs struct ng_ppp_node_config {
963949bee8SArchie Cobbs 	u_int16_t	mrru;			/* multilink peer MRRU */
973949bee8SArchie Cobbs 	u_char		enableMultilink;	/* enable multilink */
983949bee8SArchie Cobbs 	u_char		recvShortSeq;		/* recv multilink short seq # */
993949bee8SArchie Cobbs 	u_char		xmitShortSeq;		/* xmit multilink short seq # */
1003949bee8SArchie Cobbs 	u_char		enableRoundRobin;	/* xmit whole packets */
1013949bee8SArchie Cobbs 	u_char		enableIP;		/* enable IP data flow */
1023949bee8SArchie Cobbs 	u_char		enableAtalk;		/* enable AppleTalk data flow */
1033949bee8SArchie Cobbs 	u_char		enableIPX;		/* enable IPX data flow */
1043949bee8SArchie Cobbs 	u_char		enableCompression;	/* enable PPP compression */
1053949bee8SArchie Cobbs 	u_char		enableDecompression;	/* enable PPP decompression */
1063949bee8SArchie Cobbs 	u_char		enableEncryption;	/* enable PPP encryption */
1073949bee8SArchie Cobbs 	u_char		enableDecryption;	/* enable PPP decryption */
1083949bee8SArchie Cobbs 	u_char		enableVJCompression;	/* enable VJ compression */
1093949bee8SArchie Cobbs 	u_char		enableVJDecompression;	/* enable VJ decompression */
1103949bee8SArchie Cobbs 	struct ng_ppp_link_config		/* per link config params */
1113949bee8SArchie Cobbs 			links[NG_PPP_MAX_LINKS];
1123949bee8SArchie Cobbs };
1133949bee8SArchie Cobbs 
1143949bee8SArchie Cobbs /* Statistics struct for a link (or the bundle if NG_PPP_BUNDLE_LINKNUM) */
1153949bee8SArchie Cobbs struct ng_ppp_link_stat {
1163949bee8SArchie Cobbs 	u_int32_t xmitFrames;		/* xmit frames on link */
1173949bee8SArchie Cobbs 	u_int32_t xmitOctets;		/* xmit octets on link */
1183949bee8SArchie Cobbs 	u_int32_t recvFrames;		/* recv frames on link */
1193949bee8SArchie Cobbs 	u_int32_t recvOctets;		/* recv octets on link */
1203949bee8SArchie Cobbs 	u_int32_t badProtos;		/* frames rec'd with bogus protocol */
1213949bee8SArchie Cobbs 	u_int32_t dupFragments;		/* MP frames with duplicate seq # */
1223949bee8SArchie Cobbs };
1234cf49a43SJulian Elischer 
1244cf49a43SJulian Elischer #endif /* _NETGRAPH_PPP_H_ */
125