xref: /dflybsd-src/sys/netgraph7/pptpgre/ng_pptpgre.h (revision dd2616f83a8bfbc69be955139ccc159ab8241ba6)
1*dd2616f8SNuno Antunes /*
2*dd2616f8SNuno Antunes  * ng_pptpgre.h
3*dd2616f8SNuno Antunes  */
4*dd2616f8SNuno Antunes 
5*dd2616f8SNuno Antunes /*-
6*dd2616f8SNuno Antunes  * Copyright (c) 1999 Whistle Communications, Inc.
7*dd2616f8SNuno Antunes  * All rights reserved.
8*dd2616f8SNuno Antunes  *
9*dd2616f8SNuno Antunes  * Subject to the following obligations and disclaimer of warranty, use and
10*dd2616f8SNuno Antunes  * redistribution of this software, in source or object code forms, with or
11*dd2616f8SNuno Antunes  * without modifications are expressly permitted by Whistle Communications;
12*dd2616f8SNuno Antunes  * provided, however, that:
13*dd2616f8SNuno Antunes  * 1. Any and all reproductions of the source or object code must include the
14*dd2616f8SNuno Antunes  *    copyright notice above and the following disclaimer of warranties; and
15*dd2616f8SNuno Antunes  * 2. No rights are granted, in any manner or form, to use Whistle
16*dd2616f8SNuno Antunes  *    Communications, Inc. trademarks, including the mark "WHISTLE
17*dd2616f8SNuno Antunes  *    COMMUNICATIONS" on advertising, endorsements, or otherwise except as
18*dd2616f8SNuno Antunes  *    such appears in the above copyright notice or in the software.
19*dd2616f8SNuno Antunes  *
20*dd2616f8SNuno Antunes  * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
21*dd2616f8SNuno Antunes  * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
22*dd2616f8SNuno Antunes  * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
23*dd2616f8SNuno Antunes  * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
24*dd2616f8SNuno Antunes  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
25*dd2616f8SNuno Antunes  * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
26*dd2616f8SNuno Antunes  * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
27*dd2616f8SNuno Antunes  * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
28*dd2616f8SNuno Antunes  * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
29*dd2616f8SNuno Antunes  * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
30*dd2616f8SNuno Antunes  * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
31*dd2616f8SNuno Antunes  * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
32*dd2616f8SNuno Antunes  * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
33*dd2616f8SNuno Antunes  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34*dd2616f8SNuno Antunes  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
35*dd2616f8SNuno Antunes  * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
36*dd2616f8SNuno Antunes  * OF SUCH DAMAGE.
37*dd2616f8SNuno Antunes  *
38*dd2616f8SNuno Antunes  * Author: Archie Cobbs <archie@freebsd.org>
39*dd2616f8SNuno Antunes  *
40*dd2616f8SNuno Antunes  * $FreeBSD: src/sys/netgraph/ng_pptpgre.h,v 1.10 2008/03/24 22:55:22 mav Exp $
41*dd2616f8SNuno Antunes  * $DragonFly: src/sys/netgraph7/ng_pptpgre.h,v 1.2 2008/06/26 23:05:35 dillon Exp $
42*dd2616f8SNuno Antunes  * $Whistle: ng_pptpgre.h,v 1.3 1999/12/08 00:11:36 archie Exp $
43*dd2616f8SNuno Antunes  */
44*dd2616f8SNuno Antunes 
45*dd2616f8SNuno Antunes #ifndef _NETGRAPH_NG_PPTPGRE_H_
46*dd2616f8SNuno Antunes #define _NETGRAPH_NG_PPTPGRE_H_
47*dd2616f8SNuno Antunes 
48*dd2616f8SNuno Antunes /* Node type name and magic cookie */
49*dd2616f8SNuno Antunes #define NG_PPTPGRE_NODE_TYPE	"pptpgre"
50*dd2616f8SNuno Antunes #define NGM_PPTPGRE_COOKIE	1082548365
51*dd2616f8SNuno Antunes 
52*dd2616f8SNuno Antunes /* Hook names */
53*dd2616f8SNuno Antunes #define NG_PPTPGRE_HOOK_UPPER	"upper"		/* to upper layers */
54*dd2616f8SNuno Antunes #define NG_PPTPGRE_HOOK_LOWER	"lower"		/* to lower layers */
55*dd2616f8SNuno Antunes 
56*dd2616f8SNuno Antunes /* Session hooks: prefix plus hex session ID, e.g., "session_3e14" */
57*dd2616f8SNuno Antunes #define NG_PPTPGRE_HOOK_SESSION_P	"session_"
58*dd2616f8SNuno Antunes #define NG_PPTPGRE_HOOK_SESSION_F	"session_%04x"
59*dd2616f8SNuno Antunes 
60*dd2616f8SNuno Antunes /* Configuration for a session */
61*dd2616f8SNuno Antunes struct ng_pptpgre_conf {
62*dd2616f8SNuno Antunes 	u_char		enabled;	/* enables traffic flow */
63*dd2616f8SNuno Antunes 	u_char		enableDelayedAck;/* enables delayed acks */
64*dd2616f8SNuno Antunes 	u_char		enableAlwaysAck;/* always include ack with data */
65*dd2616f8SNuno Antunes 	u_char		enableWindowing;/* enable windowing algorithm */
66*dd2616f8SNuno Antunes 	u_int16_t	cid;		/* my call id */
67*dd2616f8SNuno Antunes 	u_int16_t	peerCid;	/* peer call id */
68*dd2616f8SNuno Antunes 	u_int16_t	recvWin;	/* peer recv window size */
69*dd2616f8SNuno Antunes 	u_int16_t	peerPpd;	/* peer packet processing delay
70*dd2616f8SNuno Antunes 					   (in units of 1/10 of a second) */
71*dd2616f8SNuno Antunes };
72*dd2616f8SNuno Antunes 
73*dd2616f8SNuno Antunes /* Keep this in sync with the above structure definition */
74*dd2616f8SNuno Antunes #define NG_PPTPGRE_CONF_TYPE_INFO	{			\
75*dd2616f8SNuno Antunes 	  { "enabled",		&ng_parse_uint8_type	},	\
76*dd2616f8SNuno Antunes 	  { "enableDelayedAck",	&ng_parse_uint8_type	},	\
77*dd2616f8SNuno Antunes 	  { "enableAlwaysAck",	&ng_parse_uint8_type	},	\
78*dd2616f8SNuno Antunes 	  { "enableWindowing",	&ng_parse_uint8_type	},	\
79*dd2616f8SNuno Antunes 	  { "cid",		&ng_parse_hint16_type	},	\
80*dd2616f8SNuno Antunes 	  { "peerCid",		&ng_parse_hint16_type	},	\
81*dd2616f8SNuno Antunes 	  { "recvWin",		&ng_parse_uint16_type	},	\
82*dd2616f8SNuno Antunes 	  { "peerPpd",		&ng_parse_uint16_type	},	\
83*dd2616f8SNuno Antunes 	  { NULL }						\
84*dd2616f8SNuno Antunes }
85*dd2616f8SNuno Antunes 
86*dd2616f8SNuno Antunes /* Statistics struct */
87*dd2616f8SNuno Antunes struct ng_pptpgre_stats {
88*dd2616f8SNuno Antunes 	u_int32_t xmitPackets;		/* number of GRE packets xmit */
89*dd2616f8SNuno Antunes 	u_int32_t xmitOctets;		/* number of GRE octets xmit */
90*dd2616f8SNuno Antunes 	u_int32_t xmitLoneAcks;		/* ack-only packets transmitted */
91*dd2616f8SNuno Antunes 	u_int32_t xmitDrops;		/* xmits dropped due to full window */
92*dd2616f8SNuno Antunes 	u_int32_t xmitTooBig;		/* xmits dropped because too big */
93*dd2616f8SNuno Antunes 	u_int32_t recvPackets;		/* number of GRE packets rec'd */
94*dd2616f8SNuno Antunes 	u_int32_t recvOctets;		/* number of GRE octets rec'd */
95*dd2616f8SNuno Antunes 	u_int32_t recvRunts;		/* too short packets rec'd */
96*dd2616f8SNuno Antunes 	u_int32_t recvBadGRE;		/* bogus packets rec'd (bad GRE hdr) */
97*dd2616f8SNuno Antunes 	u_int32_t recvBadAcks;		/* bogus ack's rec'd in GRE header */
98*dd2616f8SNuno Antunes 	u_int32_t recvBadCID;		/* pkts with unknown call ID rec'd */
99*dd2616f8SNuno Antunes 	u_int32_t recvOutOfOrder;	/* packets rec'd out of order */
100*dd2616f8SNuno Antunes 	u_int32_t recvDuplicates;	/* packets rec'd with duplicate seq # */
101*dd2616f8SNuno Antunes 	u_int32_t recvLoneAcks;		/* ack-only packets rec'd */
102*dd2616f8SNuno Antunes 	u_int32_t recvAckTimeouts;	/* times peer failed to ack in time */
103*dd2616f8SNuno Antunes 	u_int32_t memoryFailures;	/* times we couldn't allocate memory */
104*dd2616f8SNuno Antunes };
105*dd2616f8SNuno Antunes 
106*dd2616f8SNuno Antunes /* Keep this in sync with the above structure definition */
107*dd2616f8SNuno Antunes #define NG_PPTPGRE_STATS_TYPE_INFO	{			\
108*dd2616f8SNuno Antunes 	  { "xmitPackets",	&ng_parse_uint32_type	},	\
109*dd2616f8SNuno Antunes 	  { "xmitOctets",	&ng_parse_uint32_type	},	\
110*dd2616f8SNuno Antunes 	  { "xmitLoneAcks",	&ng_parse_uint32_type	},	\
111*dd2616f8SNuno Antunes 	  { "xmitDrops",	&ng_parse_uint32_type	},	\
112*dd2616f8SNuno Antunes 	  { "xmitTooBig",	&ng_parse_uint32_type	},	\
113*dd2616f8SNuno Antunes 	  { "recvPackets",	&ng_parse_uint32_type	},	\
114*dd2616f8SNuno Antunes 	  { "recvOctets",	&ng_parse_uint32_type	},	\
115*dd2616f8SNuno Antunes 	  { "recvRunts",	&ng_parse_uint32_type	},	\
116*dd2616f8SNuno Antunes 	  { "recvBadGRE",	&ng_parse_uint32_type	},	\
117*dd2616f8SNuno Antunes 	  { "recvBadAcks",	&ng_parse_uint32_type	},	\
118*dd2616f8SNuno Antunes 	  { "recvBadCID",	&ng_parse_uint32_type	},	\
119*dd2616f8SNuno Antunes 	  { "recvOutOfOrder",	&ng_parse_uint32_type	},	\
120*dd2616f8SNuno Antunes 	  { "recvDuplicates",	&ng_parse_uint32_type	},	\
121*dd2616f8SNuno Antunes 	  { "recvLoneAcks",	&ng_parse_uint32_type	},	\
122*dd2616f8SNuno Antunes 	  { "recvAckTimeouts",	&ng_parse_uint32_type	},	\
123*dd2616f8SNuno Antunes 	  { "memoryFailures",	&ng_parse_uint32_type	},	\
124*dd2616f8SNuno Antunes 	  { NULL }						\
125*dd2616f8SNuno Antunes }
126*dd2616f8SNuno Antunes 
127*dd2616f8SNuno Antunes /* Netgraph commands */
128*dd2616f8SNuno Antunes enum {
129*dd2616f8SNuno Antunes 	NGM_PPTPGRE_SET_CONFIG = 1,	/* supply a struct ng_pptpgre_conf */
130*dd2616f8SNuno Antunes 	NGM_PPTPGRE_GET_CONFIG,		/* returns a struct ng_pptpgre_conf */
131*dd2616f8SNuno Antunes 	NGM_PPTPGRE_GET_STATS,		/* returns struct ng_pptpgre_stats */
132*dd2616f8SNuno Antunes 	NGM_PPTPGRE_CLR_STATS,		/* clears stats */
133*dd2616f8SNuno Antunes 	NGM_PPTPGRE_GETCLR_STATS,	/* returns & clears stats */
134*dd2616f8SNuno Antunes };
135*dd2616f8SNuno Antunes 
136*dd2616f8SNuno Antunes #endif /* _NETGRAPH_NG_PPTPGRE_H_ */
137