xref: /dflybsd-src/sys/netgraph7/tcpmss/ng_tcpmss.h (revision 0a66de84cae8627c3ce35b6526f38261d18e541e)
1*0a66de84SNuno Antunes /*-
2*0a66de84SNuno Antunes  * ng_tcpmss.h
3*0a66de84SNuno Antunes  *
4*0a66de84SNuno Antunes  * Copyright (c) 2004, Alexey Popov <lollypop@flexuser.ru>
5*0a66de84SNuno Antunes  * All rights reserved.
6*0a66de84SNuno Antunes  *
7*0a66de84SNuno Antunes  * Redistribution and use in source and binary forms, with or without
8*0a66de84SNuno Antunes  * modification, are permitted provided that the following conditions
9*0a66de84SNuno Antunes  * are met:
10*0a66de84SNuno Antunes  * 1. Redistributions of source code must retain the above copyright
11*0a66de84SNuno Antunes  *    notice unmodified, this list of conditions, and the following
12*0a66de84SNuno Antunes  *    disclaimer.
13*0a66de84SNuno Antunes  * 2. Redistributions in binary form must reproduce the above copyright
14*0a66de84SNuno Antunes  *    notice, this list of conditions and the following disclaimer in the
15*0a66de84SNuno Antunes  *    documentation and/or other materials provided with the distribution.
16*0a66de84SNuno Antunes  *
17*0a66de84SNuno Antunes  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18*0a66de84SNuno Antunes  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19*0a66de84SNuno Antunes  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20*0a66de84SNuno Antunes  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21*0a66de84SNuno Antunes  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22*0a66de84SNuno Antunes  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23*0a66de84SNuno Antunes  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24*0a66de84SNuno Antunes  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25*0a66de84SNuno Antunes  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26*0a66de84SNuno Antunes  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27*0a66de84SNuno Antunes  * SUCH DAMAGE.
28*0a66de84SNuno Antunes  *
29*0a66de84SNuno Antunes  * $FreeBSD: src/sys/netgraph/ng_tcpmss.h,v 1.1 2005/06/10 08:02:34 glebius Exp $
30*0a66de84SNuno Antunes  * $DragonFly: src/sys/netgraph7/ng_tcpmss.h,v 1.2 2008/06/26 23:05:35 dillon Exp $
31*0a66de84SNuno Antunes  */
32*0a66de84SNuno Antunes 
33*0a66de84SNuno Antunes #ifndef _NETGRAPH_TCPMSS_H_
34*0a66de84SNuno Antunes #define _NETGRAPH_TCPMSS_H_
35*0a66de84SNuno Antunes 
36*0a66de84SNuno Antunes /* Node type name and magic cookie */
37*0a66de84SNuno Antunes #define NG_TCPMSS_NODE_TYPE	"tcpmss"
38*0a66de84SNuno Antunes #define NGM_TCPMSS_COOKIE	1097623478
39*0a66de84SNuno Antunes 
40*0a66de84SNuno Antunes /* Statistics structure for one hook. */
41*0a66de84SNuno Antunes struct ng_tcpmss_hookstat {
42*0a66de84SNuno Antunes 	uint64_t	Octets;
43*0a66de84SNuno Antunes 	uint64_t	Packets;
44*0a66de84SNuno Antunes 	uint16_t	maxMSS;
45*0a66de84SNuno Antunes 	uint64_t	SYNPkts;
46*0a66de84SNuno Antunes 	uint64_t	FixedPkts;
47*0a66de84SNuno Antunes };
48*0a66de84SNuno Antunes 
49*0a66de84SNuno Antunes /* Keep this in sync with the above structure definition. */
50*0a66de84SNuno Antunes #define NG_TCPMSS_HOOKSTAT_INFO	{			\
51*0a66de84SNuno Antunes 	{ "Octets",	&ng_parse_uint64_type	},	\
52*0a66de84SNuno Antunes 	{ "Packets",	&ng_parse_uint64_type	},	\
53*0a66de84SNuno Antunes 	{ "maxMSS",	&ng_parse_uint16_type	},	\
54*0a66de84SNuno Antunes 	{ "SYNPkts",	&ng_parse_uint64_type	},	\
55*0a66de84SNuno Antunes 	{ "FixedPkts",	&ng_parse_uint64_type	},	\
56*0a66de84SNuno Antunes 	{ NULL }					\
57*0a66de84SNuno Antunes }
58*0a66de84SNuno Antunes 
59*0a66de84SNuno Antunes 
60*0a66de84SNuno Antunes /* Structure for NGM_TCPMSS_CONFIG. */
61*0a66de84SNuno Antunes struct ng_tcpmss_config {
62*0a66de84SNuno Antunes 	char		inHook[NG_HOOKSIZ];
63*0a66de84SNuno Antunes 	char		outHook[NG_HOOKSIZ];
64*0a66de84SNuno Antunes 	uint16_t	maxMSS;
65*0a66de84SNuno Antunes };
66*0a66de84SNuno Antunes 
67*0a66de84SNuno Antunes /* Keep this in sync with the above structure definition. */
68*0a66de84SNuno Antunes #define NG_TCPMSS_CONFIG_INFO {				\
69*0a66de84SNuno Antunes 	{ "inHook",	&ng_parse_hookbuf_type	},	\
70*0a66de84SNuno Antunes 	{ "outHook",	&ng_parse_hookbuf_type	},	\
71*0a66de84SNuno Antunes 	{ "maxMSS",	&ng_parse_uint16_type	},	\
72*0a66de84SNuno Antunes 	{ NULL }					\
73*0a66de84SNuno Antunes }
74*0a66de84SNuno Antunes 
75*0a66de84SNuno Antunes /* Netgraph commands */
76*0a66de84SNuno Antunes enum {
77*0a66de84SNuno Antunes 	NGM_TCPMSS_GET_STATS = 1,	/* Get stats. */
78*0a66de84SNuno Antunes 	NGM_TCPMSS_CLR_STATS,		/* Clear stats. */
79*0a66de84SNuno Antunes 	NGM_TCPMSS_GETCLR_STATS,	/* "Atomically" get and clear stats. */
80*0a66de84SNuno Antunes 	NGM_TCPMSS_CONFIG		/* Set configuration. */
81*0a66de84SNuno Antunes };
82*0a66de84SNuno Antunes 
83*0a66de84SNuno Antunes #endif /* _NETGRAPH_TCPMSS_H_ */
84