1*3b2bd0f6Slogwang /*-
2*3b2bd0f6Slogwang  * Copyright (c) 2006 Alexander Motin <[email protected]>
3*3b2bd0f6Slogwang  * All rights reserved.
4*3b2bd0f6Slogwang  *
5*3b2bd0f6Slogwang  * Redistribution and use in source and binary forms, with or without
6*3b2bd0f6Slogwang  * modification, are permitted provided that the following conditions
7*3b2bd0f6Slogwang  * are met:
8*3b2bd0f6Slogwang  * 1. Redistributions of source code must retain the above copyright
9*3b2bd0f6Slogwang  *    notice unmodified, this list of conditions, and the following
10*3b2bd0f6Slogwang  *    disclaimer.
11*3b2bd0f6Slogwang  * 2. Redistributions in binary form must reproduce the above copyright
12*3b2bd0f6Slogwang  *    notice, this list of conditions and the following disclaimer in the
13*3b2bd0f6Slogwang  *    documentation and/or other materials provided with the distribution.
14*3b2bd0f6Slogwang  *
15*3b2bd0f6Slogwang  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16*3b2bd0f6Slogwang  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17*3b2bd0f6Slogwang  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18*3b2bd0f6Slogwang  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19*3b2bd0f6Slogwang  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20*3b2bd0f6Slogwang  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21*3b2bd0f6Slogwang  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22*3b2bd0f6Slogwang  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23*3b2bd0f6Slogwang  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24*3b2bd0f6Slogwang  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25*3b2bd0f6Slogwang  * SUCH DAMAGE.
26*3b2bd0f6Slogwang  *
27*3b2bd0f6Slogwang  * $FreeBSD$
28*3b2bd0f6Slogwang  */
29*3b2bd0f6Slogwang 
30*3b2bd0f6Slogwang #ifndef _NETGRAPH_NG_PRED1_H_
31*3b2bd0f6Slogwang #define _NETGRAPH_NG_PRED1_H_
32*3b2bd0f6Slogwang 
33*3b2bd0f6Slogwang /* Node type name and magic cookie */
34*3b2bd0f6Slogwang #define NG_PRED1_NODE_TYPE	"pred1"
35*3b2bd0f6Slogwang #define NGM_PRED1_COOKIE	1166902612
36*3b2bd0f6Slogwang 
37*3b2bd0f6Slogwang /* Hook names */
38*3b2bd0f6Slogwang #define NG_PRED1_HOOK_COMP	"comp"		/* compression hook */
39*3b2bd0f6Slogwang #define NG_PRED1_HOOK_DECOMP	"decomp"	/* decompression hook */
40*3b2bd0f6Slogwang 
41*3b2bd0f6Slogwang /* Config struct */
42*3b2bd0f6Slogwang struct ng_pred1_config {
43*3b2bd0f6Slogwang 	u_char		enable;			/* node enabled */
44*3b2bd0f6Slogwang };
45*3b2bd0f6Slogwang 
46*3b2bd0f6Slogwang /* Keep this in sync with the above structure definition. */
47*3b2bd0f6Slogwang #define NG_PRED1_CONFIG_INFO	{			\
48*3b2bd0f6Slogwang 	{ "enable",	&ng_parse_uint8_type	},	\
49*3b2bd0f6Slogwang 	{ NULL }					\
50*3b2bd0f6Slogwang }
51*3b2bd0f6Slogwang 
52*3b2bd0f6Slogwang /* Statistics structure for one direction. */
53*3b2bd0f6Slogwang struct ng_pred1_stats {
54*3b2bd0f6Slogwang 	uint64_t	FramesPlain;
55*3b2bd0f6Slogwang 	uint64_t	FramesComp;
56*3b2bd0f6Slogwang 	uint64_t	FramesUncomp;
57*3b2bd0f6Slogwang 	uint64_t	InOctets;
58*3b2bd0f6Slogwang 	uint64_t	OutOctets;
59*3b2bd0f6Slogwang 	uint64_t	Errors;
60*3b2bd0f6Slogwang };
61*3b2bd0f6Slogwang 
62*3b2bd0f6Slogwang /* Keep this in sync with the above structure definition. */
63*3b2bd0f6Slogwang #define NG_PRED1_STATS_INFO	{				\
64*3b2bd0f6Slogwang 	{ "FramesPlain",&ng_parse_uint64_type	},	\
65*3b2bd0f6Slogwang 	{ "FramesComp",	&ng_parse_uint64_type	},	\
66*3b2bd0f6Slogwang 	{ "FramesUncomp", &ng_parse_uint64_type	},	\
67*3b2bd0f6Slogwang 	{ "InOctets",	&ng_parse_uint64_type	},	\
68*3b2bd0f6Slogwang 	{ "OutOctets",	&ng_parse_uint64_type	},	\
69*3b2bd0f6Slogwang 	{ "Errors",	&ng_parse_uint64_type	},	\
70*3b2bd0f6Slogwang 	{ NULL }					\
71*3b2bd0f6Slogwang }
72*3b2bd0f6Slogwang 
73*3b2bd0f6Slogwang /* Netgraph commands */
74*3b2bd0f6Slogwang enum {
75*3b2bd0f6Slogwang 	NGM_PRED1_CONFIG = 1,
76*3b2bd0f6Slogwang 	NGM_PRED1_RESETREQ,			/* sent either way! */
77*3b2bd0f6Slogwang 	NGM_PRED1_GET_STATS,
78*3b2bd0f6Slogwang 	NGM_PRED1_CLR_STATS,
79*3b2bd0f6Slogwang 	NGM_PRED1_GETCLR_STATS,
80*3b2bd0f6Slogwang };
81*3b2bd0f6Slogwang 
82*3b2bd0f6Slogwang #endif /* _NETGRAPH_NG_PRED1_H_ */
83*3b2bd0f6Slogwang 
84