1170754Sdelphij/*
2170754Sdelphij * ng_async.h
3170754Sdelphij */
4170754Sdelphij
5170754Sdelphij/*-
6170754Sdelphij * Copyright (c) 1996-1999 Whistle Communications, Inc.
7170754Sdelphij * All rights reserved.
8170754Sdelphij *
9170754Sdelphij * Subject to the following obligations and disclaimer of warranty, use and
10170754Sdelphij * redistribution of this software, in source or object code forms, with or
11170754Sdelphij * without modifications are expressly permitted by Whistle Communications;
12170754Sdelphij * provided, however, that:
13170754Sdelphij * 1. Any and all reproductions of the source or object code must include the
14170754Sdelphij *    copyright notice above and the following disclaimer of warranties; and
15170754Sdelphij * 2. No rights are granted, in any manner or form, to use Whistle
16170754Sdelphij *    Communications, Inc. trademarks, including the mark "WHISTLE
17170754Sdelphij *    COMMUNICATIONS" on advertising, endorsements, or otherwise except as
18170754Sdelphij *    such appears in the above copyright notice or in the software.
19170754Sdelphij *
20170754Sdelphij * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
21170754Sdelphij * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
22170754Sdelphij * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
23170754Sdelphij * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
24170754Sdelphij * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
25170754Sdelphij * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
26170754Sdelphij * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
27170754Sdelphij * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
28170754Sdelphij * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
29170754Sdelphij * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
30170754Sdelphij * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
31170754Sdelphij * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
32170754Sdelphij * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
33170754Sdelphij * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34170754Sdelphij * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
35170754Sdelphij * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
36170754Sdelphij * OF SUCH DAMAGE.
37170754Sdelphij *
38170754Sdelphij * Author: Archie Cobbs <archie@freebsd.org>
39170754Sdelphij * $Whistle: ng_async.h,v 1.5 1999/01/25 01:17:14 archie Exp $
40170754Sdelphij */
41170754Sdelphij
42170754Sdelphij#ifndef _NETGRAPH_NG_ASYNC_H_
43170754Sdelphij#define _NETGRAPH_NG_ASYNC_H_
44170754Sdelphij
45170754Sdelphij/* Type name and cookie */
46170754Sdelphij#define NG_ASYNC_NODE_TYPE	"async"
47170754Sdelphij#define NGM_ASYNC_COOKIE	886473717
48170754Sdelphij
49170754Sdelphij/* Hook names */
50170754Sdelphij#define NG_ASYNC_HOOK_SYNC	"sync"	/* Sync frames */
51170754Sdelphij#define NG_ASYNC_HOOK_ASYNC	"async"	/* Async-encoded frames */
52170754Sdelphij
53170754Sdelphij/* Maximum receive size bounds (for both sync and async sides) */
54170754Sdelphij#define NG_ASYNC_MIN_MRU	1
55170754Sdelphij#define NG_ASYNC_MAX_MRU	8192
56170754Sdelphij#define NG_ASYNC_DEFAULT_MRU	1600
57170754Sdelphij
58170754Sdelphij/* Frame statistics */
59170754Sdelphijstruct ng_async_stat {
60170754Sdelphij	u_int32_t	syncOctets;
61170754Sdelphij	u_int32_t	syncFrames;
62170754Sdelphij	u_int32_t	syncOverflows;
63170754Sdelphij	u_int32_t	asyncOctets;
64170754Sdelphij	u_int32_t	asyncFrames;
65170754Sdelphij	u_int32_t	asyncRunts;
66170754Sdelphij	u_int32_t	asyncOverflows;
67170754Sdelphij	u_int32_t	asyncBadCheckSums;
68170754Sdelphij};
69170754Sdelphij
70170754Sdelphij/* Keep this in sync with the above structure definition */
71170754Sdelphij#define NG_ASYNC_STATS_TYPE_INFO	{			\
72170754Sdelphij	  { "syncOctets",	&ng_parse_uint32_type	},	\
73170754Sdelphij	  { "syncFrames",	&ng_parse_uint32_type	},	\
74170754Sdelphij	  { "syncOverflows",	&ng_parse_uint32_type	},	\
75170754Sdelphij	  { "asyncOctets",	&ng_parse_uint32_type	},	\
76170754Sdelphij	  { "asyncFrames",	&ng_parse_uint32_type	},	\
77170754Sdelphij	  { "asyncRunts",	&ng_parse_uint32_type	},	\
78170754Sdelphij	  { "asyncOverflows",	&ng_parse_uint32_type	},	\
79170754Sdelphij	  { "asyncBadCheckSums",&ng_parse_uint32_type	},	\
80170754Sdelphij	  { NULL }						\
81170754Sdelphij}
82170754Sdelphij
83170754Sdelphij/* Configuration for this node */
84170754Sdelphijstruct ng_async_cfg {
85170754Sdelphij	u_char		enabled;	/* Turn encoding on/off */
86170754Sdelphij	u_int16_t	amru;		/* Max receive async frame length */
87170754Sdelphij	u_int16_t	smru;		/* Max receive sync frame length */
88170754Sdelphij	u_int32_t	accm;		/* ACCM encoding */
89170754Sdelphij};
90170754Sdelphij
91170754Sdelphij/* Keep this in sync with the above structure definition */
92170754Sdelphij#define NG_ASYNC_CONFIG_TYPE_INFO	{			\
93170754Sdelphij	  { "enabled",		&ng_parse_int8_type	},	\
94170754Sdelphij	  { "amru",		&ng_parse_uint16_type	},	\
95170754Sdelphij	  { "smru",		&ng_parse_uint16_type	},	\
96170754Sdelphij	  { "accm",		&ng_parse_hint32_type	},	\
97170754Sdelphij	  { NULL }						\
98170754Sdelphij}
99170754Sdelphij
100170754Sdelphij/* Commands */
101170754Sdelphijenum {
102170754Sdelphij	NGM_ASYNC_CMD_GET_STATS = 1,	/* returns struct ng_async_stat */
103170754Sdelphij	NGM_ASYNC_CMD_CLR_STATS,
104170754Sdelphij	NGM_ASYNC_CMD_SET_CONFIG,	/* takes struct ng_async_cfg */
105170754Sdelphij	NGM_ASYNC_CMD_GET_CONFIG,	/* returns struct ng_async_cfg */
106170754Sdelphij};
107170754Sdelphij
108170754Sdelphij#endif /* _NETGRAPH_NG_ASYNC_H_ */
109170754Sdelphij