1147231Sglebius/*-
2147231Sglebius * ng_tcpmss.h
3147231Sglebius *
4147231Sglebius * Copyright (c) 2004, Alexey Popov <lollypop@flexuser.ru>
5147231Sglebius * All rights reserved.
6147231Sglebius *
7147231Sglebius * Redistribution and use in source and binary forms, with or without
8147231Sglebius * modification, are permitted provided that the following conditions
9147231Sglebius * are met:
10147231Sglebius * 1. Redistributions of source code must retain the above copyright
11147231Sglebius *    notice unmodified, this list of conditions, and the following
12147231Sglebius *    disclaimer.
13147231Sglebius * 2. Redistributions in binary form must reproduce the above copyright
14147231Sglebius *    notice, this list of conditions and the following disclaimer in the
15147231Sglebius *    documentation and/or other materials provided with the distribution.
16147231Sglebius *
17147231Sglebius * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18147231Sglebius * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19147231Sglebius * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20147231Sglebius * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21147231Sglebius * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22147231Sglebius * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23147231Sglebius * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24147231Sglebius * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25147231Sglebius * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26147231Sglebius * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27147231Sglebius * SUCH DAMAGE.
28147231Sglebius *
29147231Sglebius * $FreeBSD$
30147231Sglebius */
31147231Sglebius
32147231Sglebius#ifndef _NETGRAPH_TCPMSS_H_
33147231Sglebius#define _NETGRAPH_TCPMSS_H_
34147231Sglebius
35147231Sglebius/* Node type name and magic cookie */
36147231Sglebius#define NG_TCPMSS_NODE_TYPE	"tcpmss"
37147231Sglebius#define NGM_TCPMSS_COOKIE	1097623478
38147231Sglebius
39147231Sglebius/* Statistics structure for one hook. */
40147231Sglebiusstruct ng_tcpmss_hookstat {
41147231Sglebius	uint64_t	Octets;
42147231Sglebius	uint64_t	Packets;
43147231Sglebius	uint16_t	maxMSS;
44147231Sglebius	uint64_t	SYNPkts;
45147231Sglebius	uint64_t	FixedPkts;
46147231Sglebius};
47147231Sglebius
48147231Sglebius/* Keep this in sync with the above structure definition. */
49147231Sglebius#define NG_TCPMSS_HOOKSTAT_INFO	{			\
50147231Sglebius	{ "Octets",	&ng_parse_uint64_type	},	\
51147231Sglebius	{ "Packets",	&ng_parse_uint64_type	},	\
52147231Sglebius	{ "maxMSS",	&ng_parse_uint16_type	},	\
53147231Sglebius	{ "SYNPkts",	&ng_parse_uint64_type	},	\
54147231Sglebius	{ "FixedPkts",	&ng_parse_uint64_type	},	\
55147231Sglebius	{ NULL }					\
56147231Sglebius}
57147231Sglebius
58147231Sglebius
59147231Sglebius/* Structure for NGM_TCPMSS_CONFIG. */
60147231Sglebiusstruct ng_tcpmss_config {
61147231Sglebius	char		inHook[NG_HOOKSIZ];
62147231Sglebius	char		outHook[NG_HOOKSIZ];
63147231Sglebius	uint16_t	maxMSS;
64147231Sglebius};
65147231Sglebius
66147231Sglebius/* Keep this in sync with the above structure definition. */
67147231Sglebius#define NG_TCPMSS_CONFIG_INFO {				\
68147231Sglebius	{ "inHook",	&ng_parse_hookbuf_type	},	\
69147231Sglebius	{ "outHook",	&ng_parse_hookbuf_type	},	\
70147231Sglebius	{ "maxMSS",	&ng_parse_uint16_type	},	\
71147231Sglebius	{ NULL }					\
72147231Sglebius}
73147231Sglebius
74147231Sglebius/* Netgraph commands */
75147231Sglebiusenum {
76147231Sglebius	NGM_TCPMSS_GET_STATS = 1,	/* Get stats. */
77147231Sglebius	NGM_TCPMSS_CLR_STATS,		/* Clear stats. */
78147231Sglebius	NGM_TCPMSS_GETCLR_STATS,	/* "Atomically" get and clear stats. */
79147231Sglebius	NGM_TCPMSS_CONFIG		/* Set configuration. */
80147231Sglebius};
81147231Sglebius
82147231Sglebius#endif /* _NETGRAPH_TCPMSS_H_ */
83