/*-1* ng_etf.h2*/34/*-5* SPDX-License-Identifier: BSD-2-Clause6*7* Copyright (c) 2001, FreeBSD Incorporated8* All rights reserved.9*10* Redistribution and use in source and binary forms, with or without11* modification, are permitted provided that the following conditions12* are met:13* 1. Redistributions of source code must retain the above copyright14* notice unmodified, this list of conditions, and the following15* disclaimer.16* 2. Redistributions in binary form must reproduce the above copyright17* notice, this list of conditions and the following disclaimer in the18* documentation and/or other materials provided with the distribution.19*20* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND21* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE22* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE23* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE24* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL25* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS26* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)27* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT28* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY29* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF30* SUCH DAMAGE.31*32* Author: Julian Elischer <[email protected]>33*/3435#ifndef _NETGRAPH_NG_ETF_H_36#define _NETGRAPH_NG_ETF_H_3738/* Node type name. This should be unique among all netgraph node types */39#define NG_ETF_NODE_TYPE "etf"4041/* Node type cookie. Should also be unique. This value MUST change whenever42an incompatible change is made to this header file, to insure consistency.43The de facto method for generating cookies is to take the output of the44date command: date -u +'%s' */45#define NGM_ETF_COOKIE 9830845164647/* Hook names */48#define NG_ETF_HOOK_DOWNSTREAM "downstream"49#define NG_ETF_HOOK_NOMATCH "nomatch"5051/* Netgraph commands understood by this node type */52enum {53NGM_ETF_SET_FLAG = 1,54NGM_ETF_GET_STATUS,55NGM_ETF_SET_FILTER,5657};5859/* This structure is returned by the NGM_ETF_GET_STATUS command */60struct ng_etfstat {61u_int32_t packets_in; /* packets in from downstream */62u_int32_t packets_out; /* packets out towards downstream */63};6465/*66* This needs to be kept in sync with the above structure definition67*/68#define NG_ETF_STATS_TYPE_INFO { \69{ "packets_in", &ng_parse_uint32_type }, \70{ "packets_out", &ng_parse_uint32_type }, \71{ NULL } \72}7374/* This structure is returned by the NGM_ETF_GET_STATUS command */75struct ng_etffilter {76char matchhook[NG_HOOKSIZ]; /* hook name */77u_int16_t ethertype; /* this ethertype to this hook */78};7980/*81* This needs to be kept in sync with the above structure definition82*/83#define NG_ETF_FILTER_TYPE_INFO { \84{ "matchhook", &ng_parse_hookbuf_type }, \85{ "ethertype", &ng_parse_uint16_type }, \86{ NULL } \87}8889#endif /* _NETGRAPH_NG_ETF_H_ */909192