185722Sjulian/*- 285722Sjulian * ng_etf.h 3139823Simp */ 4139823Simp 5139823Simp/*- 685722Sjulian * Copyright (c) 2001, FreeBSD Incorporated 785722Sjulian * All rights reserved. 885722Sjulian * 985722Sjulian * Redistribution and use in source and binary forms, with or without 1085722Sjulian * modification, are permitted provided that the following conditions 1185722Sjulian * are met: 1285722Sjulian * 1. Redistributions of source code must retain the above copyright 1385722Sjulian * notice unmodified, this list of conditions, and the following 1485722Sjulian * disclaimer. 1585722Sjulian * 2. Redistributions in binary form must reproduce the above copyright 1685722Sjulian * notice, this list of conditions and the following disclaimer in the 1785722Sjulian * documentation and/or other materials provided with the distribution. 1885722Sjulian * 1985722Sjulian * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 2085722Sjulian * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2185722Sjulian * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2285722Sjulian * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 2385722Sjulian * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2485722Sjulian * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2585722Sjulian * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2685722Sjulian * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2785722Sjulian * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2885722Sjulian * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2985722Sjulian * SUCH DAMAGE. 3085722Sjulian * 3185722Sjulian * Author: Julian Elischer <julian@freebsd.org> 3285722Sjulian * 3385722Sjulian * $FreeBSD$ 3485722Sjulian */ 3585722Sjulian 36122481Sru#ifndef _NETGRAPH_NG_ETF_H_ 37122481Sru#define _NETGRAPH_NG_ETF_H_ 3885722Sjulian 3985722Sjulian/* Node type name. This should be unique among all netgraph node types */ 4085722Sjulian#define NG_ETF_NODE_TYPE "etf" 4185722Sjulian 4285722Sjulian/* Node type cookie. Should also be unique. This value MUST change whenever 4385722Sjulian an incompatible change is made to this header file, to insure consistency. 4485722Sjulian The de facto method for generating cookies is to take the output of the 4585722Sjulian date command: date -u +'%s' */ 4685722Sjulian#define NGM_ETF_COOKIE 983084516 4785722Sjulian 4885722Sjulian/* Hook names */ 4985722Sjulian#define NG_ETF_HOOK_DOWNSTREAM "downstream" 5085722Sjulian#define NG_ETF_HOOK_NOMATCH "nomatch" 5185722Sjulian 5285722Sjulian/* Netgraph commands understood by this node type */ 5385722Sjulianenum { 5485722Sjulian NGM_ETF_SET_FLAG = 1, 5585722Sjulian NGM_ETF_GET_STATUS, 5685722Sjulian NGM_ETF_SET_FILTER, 5785722Sjulian 5885722Sjulian}; 5985722Sjulian 6085722Sjulian/* This structure is returned by the NGM_ETF_GET_STATUS command */ 6185722Sjulianstruct ng_etfstat { 6285722Sjulian u_int32_t packets_in; /* packets in from downstream */ 6385722Sjulian u_int32_t packets_out; /* packets out towards downstream */ 6485722Sjulian}; 6585722Sjulian 6685722Sjulian/* 6785722Sjulian * This needs to be kept in sync with the above structure definition 6885722Sjulian */ 6985722Sjulian#define NG_ETF_STATS_TYPE_INFO { \ 7085722Sjulian { "packets_in", &ng_parse_uint32_type }, \ 7185722Sjulian { "packets_out", &ng_parse_uint32_type }, \ 7297685Sarchie { NULL } \ 7385722Sjulian} 7485722Sjulian 7585722Sjulian/* This structure is returned by the NGM_ETF_GET_STATUS command */ 7685722Sjulianstruct ng_etffilter { 77125028Sharti char matchhook[NG_HOOKSIZ]; /* hook name */ 7885722Sjulian u_int16_t ethertype; /* this ethertype to this hook */ 7985722Sjulian}; 8085722Sjulian 8185722Sjulian/* 8285722Sjulian * This needs to be kept in sync with the above structure definition 8385722Sjulian */ 8485722Sjulian#define NG_ETF_FILTER_TYPE_INFO { \ 8585722Sjulian { "matchhook", &ng_parse_hookbuf_type }, \ 8685722Sjulian { "ethertype", &ng_parse_uint16_type }, \ 8797685Sarchie { NULL } \ 8885722Sjulian} 8985722Sjulian 90122481Sru#endif /* _NETGRAPH_NG_ETF_H_ */ 91