xref: /freebsd/sys/netgraph/ng_pred1.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1700218c7SGleb Smirnoff /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3fe267a55SPedro F. Giffuni  *
4700218c7SGleb Smirnoff  * Copyright (c) 2006 Alexander Motin <mav@alkar.net>
5700218c7SGleb Smirnoff  * All rights reserved.
6700218c7SGleb Smirnoff  *
7700218c7SGleb Smirnoff  * Redistribution and use in source and binary forms, with or without
8700218c7SGleb Smirnoff  * modification, are permitted provided that the following conditions
9700218c7SGleb Smirnoff  * are met:
10700218c7SGleb Smirnoff  * 1. Redistributions of source code must retain the above copyright
11700218c7SGleb Smirnoff  *    notice unmodified, this list of conditions, and the following
12700218c7SGleb Smirnoff  *    disclaimer.
13700218c7SGleb Smirnoff  * 2. Redistributions in binary form must reproduce the above copyright
14700218c7SGleb Smirnoff  *    notice, this list of conditions and the following disclaimer in the
15700218c7SGleb Smirnoff  *    documentation and/or other materials provided with the distribution.
16700218c7SGleb Smirnoff  *
17700218c7SGleb Smirnoff  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18700218c7SGleb Smirnoff  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19700218c7SGleb Smirnoff  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20700218c7SGleb Smirnoff  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21700218c7SGleb Smirnoff  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22700218c7SGleb Smirnoff  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23700218c7SGleb Smirnoff  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24700218c7SGleb Smirnoff  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25700218c7SGleb Smirnoff  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26700218c7SGleb Smirnoff  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27700218c7SGleb Smirnoff  * SUCH DAMAGE.
28700218c7SGleb Smirnoff  */
29700218c7SGleb Smirnoff 
30700218c7SGleb Smirnoff #ifndef _NETGRAPH_NG_PRED1_H_
31700218c7SGleb Smirnoff #define _NETGRAPH_NG_PRED1_H_
32700218c7SGleb Smirnoff 
33700218c7SGleb Smirnoff /* Node type name and magic cookie */
34700218c7SGleb Smirnoff #define NG_PRED1_NODE_TYPE	"pred1"
35700218c7SGleb Smirnoff #define NGM_PRED1_COOKIE	1166902612
36700218c7SGleb Smirnoff 
37700218c7SGleb Smirnoff /* Hook names */
38700218c7SGleb Smirnoff #define NG_PRED1_HOOK_COMP	"comp"		/* compression hook */
39700218c7SGleb Smirnoff #define NG_PRED1_HOOK_DECOMP	"decomp"	/* decompression hook */
40700218c7SGleb Smirnoff 
41700218c7SGleb Smirnoff /* Config struct */
42700218c7SGleb Smirnoff struct ng_pred1_config {
43700218c7SGleb Smirnoff 	u_char		enable;			/* node enabled */
44700218c7SGleb Smirnoff };
45700218c7SGleb Smirnoff 
46700218c7SGleb Smirnoff /* Keep this in sync with the above structure definition. */
47700218c7SGleb Smirnoff #define NG_PRED1_CONFIG_INFO	{			\
48700218c7SGleb Smirnoff 	{ "enable",	&ng_parse_uint8_type	},	\
49700218c7SGleb Smirnoff 	{ NULL }					\
50700218c7SGleb Smirnoff }
51700218c7SGleb Smirnoff 
52700218c7SGleb Smirnoff /* Statistics structure for one direction. */
53700218c7SGleb Smirnoff struct ng_pred1_stats {
54700218c7SGleb Smirnoff 	uint64_t	FramesPlain;
55700218c7SGleb Smirnoff 	uint64_t	FramesComp;
56700218c7SGleb Smirnoff 	uint64_t	FramesUncomp;
57700218c7SGleb Smirnoff 	uint64_t	InOctets;
58700218c7SGleb Smirnoff 	uint64_t	OutOctets;
59700218c7SGleb Smirnoff 	uint64_t	Errors;
60700218c7SGleb Smirnoff };
61700218c7SGleb Smirnoff 
62700218c7SGleb Smirnoff /* Keep this in sync with the above structure definition. */
63700218c7SGleb Smirnoff #define NG_PRED1_STATS_INFO	{				\
64700218c7SGleb Smirnoff 	{ "FramesPlain",&ng_parse_uint64_type	},	\
65700218c7SGleb Smirnoff 	{ "FramesComp",	&ng_parse_uint64_type	},	\
66700218c7SGleb Smirnoff 	{ "FramesUncomp", &ng_parse_uint64_type	},	\
67700218c7SGleb Smirnoff 	{ "InOctets",	&ng_parse_uint64_type	},	\
68700218c7SGleb Smirnoff 	{ "OutOctets",	&ng_parse_uint64_type	},	\
69700218c7SGleb Smirnoff 	{ "Errors",	&ng_parse_uint64_type	},	\
70700218c7SGleb Smirnoff 	{ NULL }					\
71700218c7SGleb Smirnoff }
72700218c7SGleb Smirnoff 
73700218c7SGleb Smirnoff /* Netgraph commands */
74700218c7SGleb Smirnoff enum {
75700218c7SGleb Smirnoff 	NGM_PRED1_CONFIG = 1,
76700218c7SGleb Smirnoff 	NGM_PRED1_RESETREQ,			/* sent either way! */
77700218c7SGleb Smirnoff 	NGM_PRED1_GET_STATS,
78700218c7SGleb Smirnoff 	NGM_PRED1_CLR_STATS,
79700218c7SGleb Smirnoff 	NGM_PRED1_GETCLR_STATS,
80700218c7SGleb Smirnoff };
81700218c7SGleb Smirnoff 
82700218c7SGleb Smirnoff #endif /* _NETGRAPH_NG_PRED1_H_ */
83