152419Sjulian/*
252419Sjulian * ng_async.h
3139823Simp */
4139823Simp
5139823Simp/*-
652419Sjulian * Copyright (c) 1996-1999 Whistle Communications, Inc.
752419Sjulian * All rights reserved.
852419Sjulian *
952419Sjulian * Subject to the following obligations and disclaimer of warranty, use and
1052419Sjulian * redistribution of this software, in source or object code forms, with or
1152419Sjulian * without modifications are expressly permitted by Whistle Communications;
1252419Sjulian * provided, however, that:
1352419Sjulian * 1. Any and all reproductions of the source or object code must include the
1452419Sjulian *    copyright notice above and the following disclaimer of warranties; and
1552419Sjulian * 2. No rights are granted, in any manner or form, to use Whistle
1652419Sjulian *    Communications, Inc. trademarks, including the mark "WHISTLE
1752419Sjulian *    COMMUNICATIONS" on advertising, endorsements, or otherwise except as
1852419Sjulian *    such appears in the above copyright notice or in the software.
1952419Sjulian *
2052419Sjulian * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
2152419Sjulian * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
2252419Sjulian * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
2352419Sjulian * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
2452419Sjulian * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
2552419Sjulian * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
2652419Sjulian * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
2752419Sjulian * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
2852419Sjulian * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
2952419Sjulian * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
3052419Sjulian * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
3152419Sjulian * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
3252419Sjulian * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
3352419Sjulian * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3452419Sjulian * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
3552419Sjulian * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
3652419Sjulian * OF SUCH DAMAGE.
3752419Sjulian *
3867506Sjulian * Author: Archie Cobbs <archie@freebsd.org>
3952419Sjulian *
4052419Sjulian * $FreeBSD$
4152419Sjulian * $Whistle: ng_async.h,v 1.5 1999/01/25 01:17:14 archie Exp $
4252419Sjulian */
4352419Sjulian
44122481Sru#ifndef _NETGRAPH_NG_ASYNC_H_
45122481Sru#define _NETGRAPH_NG_ASYNC_H_
4652419Sjulian
4752419Sjulian/* Type name and cookie */
4852419Sjulian#define NG_ASYNC_NODE_TYPE	"async"
4953913Sarchie#define NGM_ASYNC_COOKIE	886473717
5052419Sjulian
5152419Sjulian/* Hook names */
5252976Sarchie#define NG_ASYNC_HOOK_SYNC	"sync"	/* Sync frames */
5352976Sarchie#define NG_ASYNC_HOOK_ASYNC	"async"	/* Async-encoded frames */
5452419Sjulian
5552419Sjulian/* Maximum receive size bounds (for both sync and async sides) */
5652419Sjulian#define NG_ASYNC_MIN_MRU	1
5752419Sjulian#define NG_ASYNC_MAX_MRU	8192
5852419Sjulian#define NG_ASYNC_DEFAULT_MRU	1600
5952419Sjulian
6052419Sjulian/* Frame statistics */
6152419Sjulianstruct ng_async_stat {
6252419Sjulian	u_int32_t	syncOctets;
6352419Sjulian	u_int32_t	syncFrames;
6452419Sjulian	u_int32_t	syncOverflows;
6552419Sjulian	u_int32_t	asyncOctets;
6652419Sjulian	u_int32_t	asyncFrames;
6752419Sjulian	u_int32_t	asyncRunts;
6852419Sjulian	u_int32_t	asyncOverflows;
6952419Sjulian	u_int32_t	asyncBadCheckSums;
7052419Sjulian};
7152419Sjulian
7253913Sarchie/* Keep this in sync with the above structure definition */
7353913Sarchie#define NG_ASYNC_STATS_TYPE_INFO	{			\
7464508Sarchie	  { "syncOctets",	&ng_parse_uint32_type	},	\
7564508Sarchie	  { "syncFrames",	&ng_parse_uint32_type	},	\
7664508Sarchie	  { "syncOverflows",	&ng_parse_uint32_type	},	\
7764508Sarchie	  { "asyncOctets",	&ng_parse_uint32_type	},	\
7864508Sarchie	  { "asyncFrames",	&ng_parse_uint32_type	},	\
7964508Sarchie	  { "asyncRunts",	&ng_parse_uint32_type	},	\
8064508Sarchie	  { "asyncOverflows",	&ng_parse_uint32_type	},	\
8164508Sarchie	  { "asyncBadCheckSums",&ng_parse_uint32_type	},	\
8297685Sarchie	  { NULL }						\
8353913Sarchie}
8453913Sarchie
8552419Sjulian/* Configuration for this node */
8652419Sjulianstruct ng_async_cfg {
8752419Sjulian	u_char		enabled;	/* Turn encoding on/off */
8852419Sjulian	u_int16_t	amru;		/* Max receive async frame length */
8952419Sjulian	u_int16_t	smru;		/* Max receive sync frame length */
9052419Sjulian	u_int32_t	accm;		/* ACCM encoding */
9152419Sjulian};
9252419Sjulian
9353913Sarchie/* Keep this in sync with the above structure definition */
9453913Sarchie#define NG_ASYNC_CONFIG_TYPE_INFO	{			\
9553913Sarchie	  { "enabled",		&ng_parse_int8_type	},	\
9664508Sarchie	  { "amru",		&ng_parse_uint16_type	},	\
9764508Sarchie	  { "smru",		&ng_parse_uint16_type	},	\
9864508Sarchie	  { "accm",		&ng_parse_hint32_type	},	\
9997685Sarchie	  { NULL }						\
10053913Sarchie}
10153913Sarchie
10252419Sjulian/* Commands */
10352419Sjulianenum {
10452419Sjulian	NGM_ASYNC_CMD_GET_STATS = 1,	/* returns struct ng_async_stat */
10552419Sjulian	NGM_ASYNC_CMD_CLR_STATS,
10652419Sjulian	NGM_ASYNC_CMD_SET_CONFIG,	/* takes struct ng_async_cfg */
10752419Sjulian	NGM_ASYNC_CMD_GET_CONFIG,	/* returns struct ng_async_cfg */
10852419Sjulian};
10952419Sjulian
110122481Sru#endif /* _NETGRAPH_NG_ASYNC_H_ */
111