1*bb091a26SNuno Antunes /*- 2*bb091a26SNuno Antunes * ng_etf.h 3*bb091a26SNuno Antunes */ 4*bb091a26SNuno Antunes 5*bb091a26SNuno Antunes /*- 6*bb091a26SNuno Antunes * Copyright (c) 2001, FreeBSD Incorporated 7*bb091a26SNuno Antunes * All rights reserved. 8*bb091a26SNuno Antunes * 9*bb091a26SNuno Antunes * Redistribution and use in source and binary forms, with or without 10*bb091a26SNuno Antunes * modification, are permitted provided that the following conditions 11*bb091a26SNuno Antunes * are met: 12*bb091a26SNuno Antunes * 1. Redistributions of source code must retain the above copyright 13*bb091a26SNuno Antunes * notice unmodified, this list of conditions, and the following 14*bb091a26SNuno Antunes * disclaimer. 15*bb091a26SNuno Antunes * 2. Redistributions in binary form must reproduce the above copyright 16*bb091a26SNuno Antunes * notice, this list of conditions and the following disclaimer in the 17*bb091a26SNuno Antunes * documentation and/or other materials provided with the distribution. 18*bb091a26SNuno Antunes * 19*bb091a26SNuno Antunes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 20*bb091a26SNuno Antunes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21*bb091a26SNuno Antunes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22*bb091a26SNuno Antunes * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 23*bb091a26SNuno Antunes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24*bb091a26SNuno Antunes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25*bb091a26SNuno Antunes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26*bb091a26SNuno Antunes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27*bb091a26SNuno Antunes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28*bb091a26SNuno Antunes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29*bb091a26SNuno Antunes * SUCH DAMAGE. 30*bb091a26SNuno Antunes * 31*bb091a26SNuno Antunes * Author: Julian Elischer <julian@freebsd.org> 32*bb091a26SNuno Antunes * 33*bb091a26SNuno Antunes * $FreeBSD: src/sys/netgraph/ng_etf.h,v 1.5 2005/01/07 01:45:39 imp Exp $ 34*bb091a26SNuno Antunes * $DragonFly: src/sys/netgraph7/ng_etf.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ 35*bb091a26SNuno Antunes */ 36*bb091a26SNuno Antunes 37*bb091a26SNuno Antunes #ifndef _NETGRAPH_NG_ETF_H_ 38*bb091a26SNuno Antunes #define _NETGRAPH_NG_ETF_H_ 39*bb091a26SNuno Antunes 40*bb091a26SNuno Antunes /* Node type name. This should be unique among all netgraph node types */ 41*bb091a26SNuno Antunes #define NG_ETF_NODE_TYPE "etf" 42*bb091a26SNuno Antunes 43*bb091a26SNuno Antunes /* Node type cookie. Should also be unique. This value MUST change whenever 44*bb091a26SNuno Antunes an incompatible change is made to this header file, to insure consistency. 45*bb091a26SNuno Antunes The de facto method for generating cookies is to take the output of the 46*bb091a26SNuno Antunes date command: date -u +'%s' */ 47*bb091a26SNuno Antunes #define NGM_ETF_COOKIE 983084516 48*bb091a26SNuno Antunes 49*bb091a26SNuno Antunes /* Hook names */ 50*bb091a26SNuno Antunes #define NG_ETF_HOOK_DOWNSTREAM "downstream" 51*bb091a26SNuno Antunes #define NG_ETF_HOOK_NOMATCH "nomatch" 52*bb091a26SNuno Antunes 53*bb091a26SNuno Antunes /* Netgraph commands understood by this node type */ 54*bb091a26SNuno Antunes enum { 55*bb091a26SNuno Antunes NGM_ETF_SET_FLAG = 1, 56*bb091a26SNuno Antunes NGM_ETF_GET_STATUS, 57*bb091a26SNuno Antunes NGM_ETF_SET_FILTER, 58*bb091a26SNuno Antunes 59*bb091a26SNuno Antunes }; 60*bb091a26SNuno Antunes 61*bb091a26SNuno Antunes /* This structure is returned by the NGM_ETF_GET_STATUS command */ 62*bb091a26SNuno Antunes struct ng_etfstat { 63*bb091a26SNuno Antunes u_int32_t packets_in; /* packets in from downstream */ 64*bb091a26SNuno Antunes u_int32_t packets_out; /* packets out towards downstream */ 65*bb091a26SNuno Antunes }; 66*bb091a26SNuno Antunes 67*bb091a26SNuno Antunes /* 68*bb091a26SNuno Antunes * This needs to be kept in sync with the above structure definition 69*bb091a26SNuno Antunes */ 70*bb091a26SNuno Antunes #define NG_ETF_STATS_TYPE_INFO { \ 71*bb091a26SNuno Antunes { "packets_in", &ng_parse_uint32_type }, \ 72*bb091a26SNuno Antunes { "packets_out", &ng_parse_uint32_type }, \ 73*bb091a26SNuno Antunes { NULL } \ 74*bb091a26SNuno Antunes } 75*bb091a26SNuno Antunes 76*bb091a26SNuno Antunes /* This structure is returned by the NGM_ETF_GET_STATUS command */ 77*bb091a26SNuno Antunes struct ng_etffilter { 78*bb091a26SNuno Antunes char matchhook[NG_HOOKSIZ]; /* hook name */ 79*bb091a26SNuno Antunes u_int16_t ethertype; /* this ethertype to this hook */ 80*bb091a26SNuno Antunes }; 81*bb091a26SNuno Antunes 82*bb091a26SNuno Antunes /* 83*bb091a26SNuno Antunes * This needs to be kept in sync with the above structure definition 84*bb091a26SNuno Antunes */ 85*bb091a26SNuno Antunes #define NG_ETF_FILTER_TYPE_INFO { \ 86*bb091a26SNuno Antunes { "matchhook", &ng_parse_hookbuf_type }, \ 87*bb091a26SNuno Antunes { "ethertype", &ng_parse_uint16_type }, \ 88*bb091a26SNuno Antunes { NULL } \ 89*bb091a26SNuno Antunes } 90*bb091a26SNuno Antunes 91*bb091a26SNuno Antunes #endif /* _NETGRAPH_NG_ETF_H_ */ 92