154331Sarchie/*
254331Sarchie * ng_pptpgre.h
3139823Simp */
4139823Simp
5139823Simp/*-
654331Sarchie * Copyright (c) 1999 Whistle Communications, Inc.
754331Sarchie * All rights reserved.
854331Sarchie *
954331Sarchie * Subject to the following obligations and disclaimer of warranty, use and
1054331Sarchie * redistribution of this software, in source or object code forms, with or
1154331Sarchie * without modifications are expressly permitted by Whistle Communications;
1254331Sarchie * provided, however, that:
1354331Sarchie * 1. Any and all reproductions of the source or object code must include the
1454331Sarchie *    copyright notice above and the following disclaimer of warranties; and
1554331Sarchie * 2. No rights are granted, in any manner or form, to use Whistle
1654331Sarchie *    Communications, Inc. trademarks, including the mark "WHISTLE
1754331Sarchie *    COMMUNICATIONS" on advertising, endorsements, or otherwise except as
1854331Sarchie *    such appears in the above copyright notice or in the software.
1954331Sarchie *
2054331Sarchie * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
2154331Sarchie * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
2254331Sarchie * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
2354331Sarchie * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
2454331Sarchie * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
2554331Sarchie * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
2654331Sarchie * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
2754331Sarchie * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
2854331Sarchie * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
2954331Sarchie * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
3054331Sarchie * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
3154331Sarchie * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
3254331Sarchie * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
3354331Sarchie * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3454331Sarchie * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
3554331Sarchie * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
3654331Sarchie * OF SUCH DAMAGE.
3754331Sarchie *
3867506Sjulian * Author: Archie Cobbs <archie@freebsd.org>
3954331Sarchie *
4054331Sarchie * $FreeBSD$
4154331Sarchie * $Whistle: ng_pptpgre.h,v 1.3 1999/12/08 00:11:36 archie Exp $
4254331Sarchie */
4354331Sarchie
44122481Sru#ifndef _NETGRAPH_NG_PPTPGRE_H_
45122481Sru#define _NETGRAPH_NG_PPTPGRE_H_
4654331Sarchie
4754331Sarchie/* Node type name and magic cookie */
4854331Sarchie#define NG_PPTPGRE_NODE_TYPE	"pptpgre"
49128657Sarchie#define NGM_PPTPGRE_COOKIE	1082548365
5054331Sarchie
5154331Sarchie/* Hook names */
5254331Sarchie#define NG_PPTPGRE_HOOK_UPPER	"upper"		/* to upper layers */
5354331Sarchie#define NG_PPTPGRE_HOOK_LOWER	"lower"		/* to lower layers */
5454331Sarchie
55177587Smav/* Session hooks: prefix plus hex session ID, e.g., "session_3e14" */
56177587Smav#define NG_PPTPGRE_HOOK_SESSION_P	"session_"
57177587Smav#define NG_PPTPGRE_HOOK_SESSION_F	"session_%04x"
58177587Smav
5954331Sarchie/* Configuration for a session */
6054331Sarchiestruct ng_pptpgre_conf {
6154331Sarchie	u_char		enabled;	/* enables traffic flow */
6254331Sarchie	u_char		enableDelayedAck;/* enables delayed acks */
6363822Sarchie	u_char		enableAlwaysAck;/* always include ack with data */
64128657Sarchie	u_char		enableWindowing;/* enable windowing algorithm */
6554331Sarchie	u_int16_t	cid;		/* my call id */
6654331Sarchie	u_int16_t	peerCid;	/* peer call id */
6754331Sarchie	u_int16_t	recvWin;	/* peer recv window size */
6854331Sarchie	u_int16_t	peerPpd;	/* peer packet processing delay
6954331Sarchie					   (in units of 1/10 of a second) */
7054331Sarchie};
7154331Sarchie
7254331Sarchie/* Keep this in sync with the above structure definition */
7354331Sarchie#define NG_PPTPGRE_CONF_TYPE_INFO	{			\
7464508Sarchie	  { "enabled",		&ng_parse_uint8_type	},	\
7564508Sarchie	  { "enableDelayedAck",	&ng_parse_uint8_type	},	\
7664508Sarchie	  { "enableAlwaysAck",	&ng_parse_uint8_type	},	\
77128657Sarchie	  { "enableWindowing",	&ng_parse_uint8_type	},	\
7864508Sarchie	  { "cid",		&ng_parse_hint16_type	},	\
7964508Sarchie	  { "peerCid",		&ng_parse_hint16_type	},	\
8064508Sarchie	  { "recvWin",		&ng_parse_uint16_type	},	\
8164508Sarchie	  { "peerPpd",		&ng_parse_uint16_type	},	\
8297685Sarchie	  { NULL }						\
8354331Sarchie}
8454331Sarchie
8560009Sarchie/* Statistics struct */
8660009Sarchiestruct ng_pptpgre_stats {
8760009Sarchie	u_int32_t xmitPackets;		/* number of GRE packets xmit */
8860009Sarchie	u_int32_t xmitOctets;		/* number of GRE octets xmit */
8960009Sarchie	u_int32_t xmitLoneAcks;		/* ack-only packets transmitted */
9060009Sarchie	u_int32_t xmitDrops;		/* xmits dropped due to full window */
9160009Sarchie	u_int32_t xmitTooBig;		/* xmits dropped because too big */
9260009Sarchie	u_int32_t recvPackets;		/* number of GRE packets rec'd */
9360009Sarchie	u_int32_t recvOctets;		/* number of GRE octets rec'd */
9460009Sarchie	u_int32_t recvRunts;		/* too short packets rec'd */
9560009Sarchie	u_int32_t recvBadGRE;		/* bogus packets rec'd (bad GRE hdr) */
9660009Sarchie	u_int32_t recvBadAcks;		/* bogus ack's rec'd in GRE header */
9760009Sarchie	u_int32_t recvBadCID;		/* pkts with unknown call ID rec'd */
9860009Sarchie	u_int32_t recvOutOfOrder;	/* packets rec'd out of order */
9960009Sarchie	u_int32_t recvDuplicates;	/* packets rec'd with duplicate seq # */
10060009Sarchie	u_int32_t recvLoneAcks;		/* ack-only packets rec'd */
10160009Sarchie	u_int32_t recvAckTimeouts;	/* times peer failed to ack in time */
10263822Sarchie	u_int32_t memoryFailures;	/* times we couldn't allocate memory */
10360009Sarchie};
10460009Sarchie
10560009Sarchie/* Keep this in sync with the above structure definition */
10660009Sarchie#define NG_PPTPGRE_STATS_TYPE_INFO	{			\
10764508Sarchie	  { "xmitPackets",	&ng_parse_uint32_type	},	\
10864508Sarchie	  { "xmitOctets",	&ng_parse_uint32_type	},	\
10964508Sarchie	  { "xmitLoneAcks",	&ng_parse_uint32_type	},	\
11064508Sarchie	  { "xmitDrops",	&ng_parse_uint32_type	},	\
11164508Sarchie	  { "xmitTooBig",	&ng_parse_uint32_type	},	\
11264508Sarchie	  { "recvPackets",	&ng_parse_uint32_type	},	\
11364508Sarchie	  { "recvOctets",	&ng_parse_uint32_type	},	\
11464508Sarchie	  { "recvRunts",	&ng_parse_uint32_type	},	\
11564508Sarchie	  { "recvBadGRE",	&ng_parse_uint32_type	},	\
11664508Sarchie	  { "recvBadAcks",	&ng_parse_uint32_type	},	\
11764508Sarchie	  { "recvBadCID",	&ng_parse_uint32_type	},	\
11864508Sarchie	  { "recvOutOfOrder",	&ng_parse_uint32_type	},	\
11964508Sarchie	  { "recvDuplicates",	&ng_parse_uint32_type	},	\
12064508Sarchie	  { "recvLoneAcks",	&ng_parse_uint32_type	},	\
12164508Sarchie	  { "recvAckTimeouts",	&ng_parse_uint32_type	},	\
12264508Sarchie	  { "memoryFailures",	&ng_parse_uint32_type	},	\
12360009Sarchie	  { NULL }						\
12460009Sarchie}
12560009Sarchie
12654331Sarchie/* Netgraph commands */
12754331Sarchieenum {
12854331Sarchie	NGM_PPTPGRE_SET_CONFIG = 1,	/* supply a struct ng_pptpgre_conf */
12954331Sarchie	NGM_PPTPGRE_GET_CONFIG,		/* returns a struct ng_pptpgre_conf */
13060009Sarchie	NGM_PPTPGRE_GET_STATS,		/* returns struct ng_pptpgre_stats */
13160009Sarchie	NGM_PPTPGRE_CLR_STATS,		/* clears stats */
13260009Sarchie	NGM_PPTPGRE_GETCLR_STATS,	/* returns & clears stats */
13354331Sarchie};
13454331Sarchie
135122481Sru#endif /* _NETGRAPH_NG_PPTPGRE_H_ */
136