ng_etf.h revision 97685
1251876Speter/*- 2251876Speter * ng_etf.h 3251876Speter * 4251876Speter * Copyright (c) 2001, FreeBSD Incorporated 5251876Speter * All rights reserved. 6251876Speter * 7251876Speter * Redistribution and use in source and binary forms, with or without 8251876Speter * modification, are permitted provided that the following conditions 9251876Speter * are met: 10251876Speter * 1. Redistributions of source code must retain the above copyright 11251876Speter * notice unmodified, this list of conditions, and the following 12251876Speter * disclaimer. 13251876Speter * 2. Redistributions in binary form must reproduce the above copyright 14251876Speter * notice, this list of conditions and the following disclaimer in the 15251876Speter * documentation and/or other materials provided with the distribution. 16251876Speter * 17251876Speter * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18251876Speter * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19251876Speter * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20251876Speter * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21251876Speter * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22251876Speter * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23251876Speter * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24251876Speter * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25251876Speter * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26251876Speter * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27251876Speter * SUCH DAMAGE. 28251876Speter * 29251876Speter * Author: Julian Elischer <julian@freebsd.org> 30251876Speter * 31251876Speter * $FreeBSD: head/sys/netgraph/ng_etf.h 97685 2002-05-31 23:48:03Z archie $ 32251876Speter */ 33251876Speter 34251876Speter#ifndef _NETGRAPH_ETHERTYPE_FILTER_H_ 35251876Speter#define _NETGRAPH_ETHERTYPE_FILTER_H_ 36251876Speter 37251876Speter/* Node type name. This should be unique among all netgraph node types */ 38251876Speter#define NG_ETF_NODE_TYPE "etf" 39251876Speter 40251876Speter/* Node type cookie. Should also be unique. This value MUST change whenever 41251876Speter an incompatible change is made to this header file, to insure consistency. 42251876Speter The de facto method for generating cookies is to take the output of the 43251876Speter date command: date -u +'%s' */ 44251876Speter#define NGM_ETF_COOKIE 983084516 45251876Speter 46251876Speter/* Hook names */ 47251876Speter#define NG_ETF_HOOK_DOWNSTREAM "downstream" 48251876Speter#define NG_ETF_HOOK_NOMATCH "nomatch" 49251876Speter 50251876Speter/* Netgraph commands understood by this node type */ 51251876Speterenum { 52251876Speter NGM_ETF_SET_FLAG = 1, 53251876Speter NGM_ETF_GET_STATUS, 54251876Speter NGM_ETF_SET_FILTER, 55251876Speter 56251876Speter}; 57251876Speter 58251876Speter/* This structure is returned by the NGM_ETF_GET_STATUS command */ 59251876Speterstruct ng_etfstat { 60251876Speter u_int32_t packets_in; /* packets in from downstream */ 61251876Speter u_int32_t packets_out; /* packets out towards downstream */ 62251876Speter}; 63251876Speter 64251876Speter/* 65251876Speter * This needs to be kept in sync with the above structure definition 66251876Speter */ 67251876Speter#define NG_ETF_STATS_TYPE_INFO { \ 68251876Speter { "packets_in", &ng_parse_uint32_type }, \ 69251876Speter { "packets_out", &ng_parse_uint32_type }, \ 70251876Speter { NULL } \ 71251876Speter} 72251876Speter 73251876Speter/* This structure is returned by the NGM_ETF_GET_STATUS command */ 74251876Speterstruct ng_etffilter { 75251876Speter char matchhook[NG_HOOKLEN + 1]; /* hook name */ 76251876Speter u_int16_t ethertype; /* this ethertype to this hook */ 77251876Speter}; 78251876Speter 79251876Speter/* 80251876Speter * This needs to be kept in sync with the above structure definition 81251876Speter */ 82251876Speter#define NG_ETF_FILTER_TYPE_INFO { \ 83251876Speter { "matchhook", &ng_parse_hookbuf_type }, \ 84251876Speter { "ethertype", &ng_parse_uint16_type }, \ 85251876Speter { NULL } \ 86251876Speter} 87251876Speter 88251876Speter#endif /* _NETGRAPH_ETHERTYPE_FILTER_H_ */ 89251876Speter