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