ng_tee.h revision 97685
152419Sjulian
252419Sjulian/*
352419Sjulian * ng_tee.h
452419Sjulian *
552419Sjulian * Copyright (c) 1996-1999 Whistle Communications, Inc.
652419Sjulian * All rights reserved.
752419Sjulian *
852419Sjulian * Subject to the following obligations and disclaimer of warranty, use and
952419Sjulian * redistribution of this software, in source or object code forms, with or
1052419Sjulian * without modifications are expressly permitted by Whistle Communications;
1152419Sjulian * provided, however, that:
1252419Sjulian * 1. Any and all reproductions of the source or object code must include the
1352419Sjulian *    copyright notice above and the following disclaimer of warranties; and
1452419Sjulian * 2. No rights are granted, in any manner or form, to use Whistle
1552419Sjulian *    Communications, Inc. trademarks, including the mark "WHISTLE
1652419Sjulian *    COMMUNICATIONS" on advertising, endorsements, or otherwise except as
1752419Sjulian *    such appears in the above copyright notice or in the software.
1852419Sjulian *
1952419Sjulian * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
2052419Sjulian * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
2152419Sjulian * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
2252419Sjulian * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
2352419Sjulian * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
2452419Sjulian * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
2552419Sjulian * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
2652419Sjulian * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
2752419Sjulian * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
2852419Sjulian * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
2952419Sjulian * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
3052419Sjulian * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
3152419Sjulian * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
3252419Sjulian * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3352419Sjulian * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
3452419Sjulian * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
3552419Sjulian * OF SUCH DAMAGE.
3652419Sjulian *
3767506Sjulian * Author: Archie Cobbs <archie@freebsd.org>
3852419Sjulian *
3952419Sjulian * $FreeBSD: head/sys/netgraph/ng_tee.h 97685 2002-05-31 23:48:03Z archie $
4052419Sjulian * $Whistle: ng_tee.h,v 1.2 1999/01/20 00:22:14 archie Exp $
4152419Sjulian */
4252419Sjulian
4352419Sjulian#ifndef _NETGRAPH_TEE_H_
4452419Sjulian#define _NETGRAPH_TEE_H_
4552419Sjulian
4652419Sjulian/* Node type name and magic cookie */
4752419Sjulian#define NG_TEE_NODE_TYPE	"tee"
4852419Sjulian#define NGM_TEE_COOKIE		916107047
4952419Sjulian
5052419Sjulian/* Hook names */
5152419Sjulian#define NG_TEE_HOOK_RIGHT	"right"
5252419Sjulian#define NG_TEE_HOOK_LEFT	"left"
5352419Sjulian#define NG_TEE_HOOK_RIGHT2LEFT	"right2left"
5452419Sjulian#define NG_TEE_HOOK_LEFT2RIGHT	"left2right"
5552419Sjulian
5652817Sarchie/* Statistics structure for one hook */
5752817Sarchiestruct ng_tee_hookstat {
5852817Sarchie	u_int64_t	inOctets;
5952817Sarchie	u_int64_t	inFrames;
6052817Sarchie	u_int64_t	outOctets;
6152817Sarchie	u_int64_t	outFrames;
6252817Sarchie};
6352817Sarchie
6456658Sarchie/* Keep this in sync with the above structure definition */
6556658Sarchie#define NG_TEE_HOOKSTAT_INFO	{				\
6664507Sarchie	  { "inOctets",		&ng_parse_uint64_type	},	\
6764507Sarchie	  { "inFrames",		&ng_parse_uint64_type	},	\
6864507Sarchie	  { "outOctets",	&ng_parse_uint64_type	},	\
6964507Sarchie	  { "outFrames",	&ng_parse_uint64_type	},	\
7097685Sarchie	  { NULL }						\
7156658Sarchie}
7256658Sarchie
7352817Sarchie/* Statistics structure returned by NGM_TEE_GET_STATS */
7452817Sarchiestruct ng_tee_stats {
7552817Sarchie	struct ng_tee_hookstat	right;
7652817Sarchie	struct ng_tee_hookstat	left;
7752817Sarchie	struct ng_tee_hookstat	right2left;
7852817Sarchie	struct ng_tee_hookstat	left2right;
7952817Sarchie};
8052817Sarchie
8156658Sarchie/* Keep this in sync with the above structure definition */
8256658Sarchie#define NG_TEE_STATS_INFO(hstype)	{			\
8356658Sarchie	  { "right",		(hstype)		},	\
8456658Sarchie	  { "left",		(hstype)		},	\
8556658Sarchie	  { "right2left",	(hstype)		},	\
8656658Sarchie	  { "left2right",	(hstype)		},	\
8797685Sarchie	  { NULL }						\
8856658Sarchie}
8956658Sarchie
9052817Sarchie/* Netgraph commands */
9152817Sarchieenum {
9252817Sarchie	NGM_TEE_GET_STATS = 1,		/* get stats */
9352817Sarchie	NGM_TEE_CLR_STATS,		/* clear stats */
9464507Sarchie	NGM_TEE_GETCLR_STATS,		/* atomically get and clear stats */
9552817Sarchie};
9652817Sarchie
9752419Sjulian#endif /* _NETGRAPH_TEE_H_ */
98