xref: /freebsd/sys/dev/usb/misc/udbp.h (revision f5e3329a5a480aa1b2904106b2fdfd999439455b)
102ac6454SAndrew Thompson /*-
202ac6454SAndrew Thompson  * Copyright (c) 1996-2000 Whistle Communications, Inc.
302ac6454SAndrew Thompson  * All rights reserved.
402ac6454SAndrew Thompson  *
502ac6454SAndrew Thompson  * Subject to the following obligations and disclaimer of warranty, use and
602ac6454SAndrew Thompson  * redistribution of this software, in source or object code forms, with or
702ac6454SAndrew Thompson  * without modifications are expressly permitted by Whistle Communications;
802ac6454SAndrew Thompson  * provided, however, that:
902ac6454SAndrew Thompson  * 1. Any and all reproductions of the source or object code must include the
1002ac6454SAndrew Thompson  *    copyright notice above and the following disclaimer of warranties; and
1102ac6454SAndrew Thompson  * 2. No rights are granted, in any manner or form, to use Whistle
1202ac6454SAndrew Thompson  *    Communications, Inc. trademarks, including the mark "WHISTLE
1302ac6454SAndrew Thompson  *    COMMUNICATIONS" on advertising, endorsements, or otherwise except as
1402ac6454SAndrew Thompson  *    such appears in the above copyright notice or in the software.
1502ac6454SAndrew Thompson  *
1602ac6454SAndrew Thompson  * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
1702ac6454SAndrew Thompson  * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
1802ac6454SAndrew Thompson  * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
1902ac6454SAndrew Thompson  * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
2002ac6454SAndrew Thompson  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
2102ac6454SAndrew Thompson  * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
2202ac6454SAndrew Thompson  * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
2302ac6454SAndrew Thompson  * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
2402ac6454SAndrew Thompson  * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
2502ac6454SAndrew Thompson  * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
2602ac6454SAndrew Thompson  * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
2702ac6454SAndrew Thompson  * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
2802ac6454SAndrew Thompson  * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
2902ac6454SAndrew Thompson  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3002ac6454SAndrew Thompson  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
3102ac6454SAndrew Thompson  * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
3202ac6454SAndrew Thompson  * OF SUCH DAMAGE.
3302ac6454SAndrew Thompson  *
3402ac6454SAndrew Thompson  * This file was derived from src/sys/netgraph/ng_sample.h, revision 1.1
3502ac6454SAndrew Thompson  * written by Julian Elischer, Whistle Communications.
3602ac6454SAndrew Thompson  */
3702ac6454SAndrew Thompson 
3802ac6454SAndrew Thompson #ifndef	_NETGRAPH_UDBP_H_
3902ac6454SAndrew Thompson #define	_NETGRAPH_UDBP_H_
4002ac6454SAndrew Thompson 
4102ac6454SAndrew Thompson /* Node type name. This should be unique among all netgraph node types */
4202ac6454SAndrew Thompson #define	NG_UDBP_NODE_TYPE	"udbp"
4302ac6454SAndrew Thompson 
4402ac6454SAndrew Thompson /* Node type cookie. Should also be unique. This value MUST change whenever
4502ac6454SAndrew Thompson    an incompatible change is made to this header file, to insure consistency.
4602ac6454SAndrew Thompson    The de facto method for generating cookies is to take the output of the
4702ac6454SAndrew Thompson    date command: date -u +'%s' */
4802ac6454SAndrew Thompson #define	NGM_UDBP_COOKIE		944609300
4902ac6454SAndrew Thompson 
5002ac6454SAndrew Thompson #define	NG_UDBP_HOOK_NAME	"data"
5102ac6454SAndrew Thompson 
5202ac6454SAndrew Thompson /* Netgraph commands understood by this node type */
5302ac6454SAndrew Thompson enum {
5402ac6454SAndrew Thompson 	NGM_UDBP_SET_FLAG = 1,
5502ac6454SAndrew Thompson 	NGM_UDBP_GET_STATUS,
5602ac6454SAndrew Thompson };
5702ac6454SAndrew Thompson 
5802ac6454SAndrew Thompson /* This structure is returned by the NGM_UDBP_GET_STATUS command */
5902ac6454SAndrew Thompson struct ngudbpstat {
6002ac6454SAndrew Thompson 	uint32_t packets_in;		/* packets in from downstream */
6102ac6454SAndrew Thompson 	uint32_t packets_out;		/* packets out towards downstream */
6202ac6454SAndrew Thompson };
6302ac6454SAndrew Thompson 
6402ac6454SAndrew Thompson /*
6502ac6454SAndrew Thompson  * This is used to define the 'parse type' for a struct ngudbpstat, which
66*f5e3329aSGordon Bergling  * is basically a description of how to convert a binary struct ngudbpstat
6702ac6454SAndrew Thompson  * to an ASCII string and back.  See ng_parse.h for more info.
6802ac6454SAndrew Thompson  *
6902ac6454SAndrew Thompson  * This needs to be kept in sync with the above structure definition
7002ac6454SAndrew Thompson  */
7102ac6454SAndrew Thompson #define	NG_UDBP_STATS_TYPE_INFO	{					\
7202ac6454SAndrew Thompson 	  { "packets_in",	&ng_parse_int32_type	},		\
7302ac6454SAndrew Thompson 	  { "packets_out",	&ng_parse_int32_type	},		\
7402ac6454SAndrew Thompson 	  { NULL },							\
7502ac6454SAndrew Thompson }
7602ac6454SAndrew Thompson 
7702ac6454SAndrew Thompson #endif					/* _NETGRAPH_UDBP_H_ */
78