1 /*
2  * ng_h4.h
3  */
4 
5 /*-
6  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
7  *
8  * Copyright (c) 2001-2002 Maksim Yevmenkin <[email protected]>
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in the
18  *    documentation and/or other materials provided with the distribution.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30  * SUCH DAMAGE.
31  *
32  * $Id: ng_h4.h,v 1.1 2002/11/24 19:47:05 max Exp $
33  * $FreeBSD$
34  *
35  * Based on:
36  * ---------
37  *
38  * FreeBSD: src/sys/netgraph/ng_tty.h
39  * Author: Archie Cobbs <[email protected]>
40  */
41 
42 /*
43  * This file contains everything that application needs to know about
44  * Bluetooth HCI UART transport layer as per chapter H4 of the Bluetooth
45  * Specification Book v1.1.
46  *
47  * This file can be included by both kernel and userland applications.
48  */
49 
50 #ifndef _NETGRAPH_H4_H_
51 #define _NETGRAPH_H4_H_
52 
53 /**************************************************************************
54  **************************************************************************
55  **     Netgraph node hook name, type name and type cookie and commands
56  **************************************************************************
57  **************************************************************************/
58 
59 /* Hook name */
60 #define NG_H4_HOOK		"hook"
61 
62 /* Node type name and magic cookie */
63 #define NG_H4_NODE_TYPE		"h4"
64 #define NGM_H4_COOKIE		1013899512
65 
66 /* Node states */
67 #define NG_H4_W4_PKT_IND	1	/* Waiting for packet indicator */
68 #define NG_H4_W4_PKT_HDR	2	/* Waiting for packet header */
69 #define NG_H4_W4_PKT_DATA	3	/* Waiting for packet data */
70 
71 /* Debug levels */
72 #define NG_H4_ALERT_LEVEL	1
73 #define NG_H4_ERR_LEVEL		2
74 #define NG_H4_WARN_LEVEL	3
75 #define NG_H4_INFO_LEVEL	4
76 
77 /**************************************************************************
78  **************************************************************************
79  **                    H4 node command/event parameters
80  **************************************************************************
81  **************************************************************************/
82 
83 /* Reset node */
84 #define NGM_H4_NODE_RESET	1
85 
86 /* Get node state (see states above) */
87 #define NGM_H4_NODE_GET_STATE	2
88 typedef u_int16_t	ng_h4_node_state_ep;
89 
90 /* Get/Set node debug level (see levels above) */
91 #define NGM_H4_NODE_GET_DEBUG	3
92 #define NGM_H4_NODE_SET_DEBUG	4
93 typedef u_int16_t	ng_h4_node_debug_ep;
94 
95 /* Get/Set max queue length for the node */
96 #define NGM_H4_NODE_GET_QLEN	5
97 #define NGM_H4_NODE_SET_QLEN	6
98 typedef int32_t		ng_h4_node_qlen_ep;
99 
100 /* Get node statistic */
101 #define NGM_H4_NODE_GET_STAT	7
102 typedef struct {
103 	u_int32_t	pckts_recv; /* # of packets received */
104 	u_int32_t	bytes_recv; /* # of bytes received */
105 	u_int32_t	pckts_sent; /* # of packets sent */
106 	u_int32_t	bytes_sent; /* # of bytes sent */
107 	u_int32_t	oerrors;    /* # of output errors */
108 	u_int32_t	ierrors;    /* # of input errors */
109 } ng_h4_node_stat_ep;
110 
111 /* Reset node statistic */
112 #define NGM_H4_NODE_RESET_STAT	8
113 
114 #endif /* _NETGRAPH_H4_H_ */
115