xref: /freebsd/sys/netgraph/bluetooth/hci/ng_hci_prse.h (revision af23369a6deaaeb612ab266eb88b8bb8d560c322)
1 /*
2  * ng_hci_prse.h
3  */
4 
5 /*-
6  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
7  *
8  * Copyright (c) 2001 Maksim Yevmenkin <m_evmenkin@yahoo.com>
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_hci_prse.h,v 1.2 2003/03/18 00:09:36 max Exp $
33  * $FreeBSD$
34  */
35 
36 /***************************************************************************
37  ***************************************************************************
38  **                  ng_parse definitions for the HCI node
39  ***************************************************************************
40  ***************************************************************************/
41 
42 #ifndef _NETGRAPH_HCI_PRSE_H_
43 #define _NETGRAPH_HCI_PRSE_H_
44 
45 /* BDADDR */
46 static const struct ng_parse_fixedarray_info	ng_hci_bdaddr_type_info = {
47 	&ng_parse_uint8_type,
48 	NG_HCI_BDADDR_SIZE
49 };
50 static const struct ng_parse_type		ng_hci_bdaddr_type = {
51 	&ng_parse_fixedarray_type,
52 	&ng_hci_bdaddr_type_info
53 };
54 
55 /* Features */
56 static const struct ng_parse_fixedarray_info	ng_hci_features_type_info = {
57 	&ng_parse_uint8_type,
58 	NG_HCI_FEATURES_SIZE
59 };
60 static const struct ng_parse_type		ng_hci_features_type = {
61 	&ng_parse_fixedarray_type,
62 	&ng_hci_features_type_info
63 };
64 
65 /* Buffer info */
66 static const struct ng_parse_struct_field	ng_hci_buffer_type_fields[] =
67 {
68 	{ "cmd_free",	&ng_parse_uint8_type,  },
69 	{ "sco_size",	&ng_parse_uint8_type,  },
70 	{ "sco_pkts",	&ng_parse_uint16_type, },
71 	{ "sco_free",	&ng_parse_uint16_type, },
72 	{ "acl_size",	&ng_parse_uint16_type, },
73 	{ "acl_pkts",	&ng_parse_uint16_type, },
74 	{ "acl_free",	&ng_parse_uint16_type, },
75 	{ NULL, }
76 };
77 static const struct ng_parse_type		ng_hci_buffer_type = {
78 	&ng_parse_struct_type,
79 	&ng_hci_buffer_type_fields
80 };
81 
82 /* Stat info */
83 static const struct ng_parse_struct_field	ng_hci_stat_type_fields[] =
84 {
85 	{ "cmd_sent",	&ng_parse_uint32_type, },
86 	{ "evnt_recv",	&ng_parse_uint32_type, },
87 	{ "acl_recv",	&ng_parse_uint32_type, },
88 	{ "acl_sent",	&ng_parse_uint32_type, },
89 	{ "sco_recv",	&ng_parse_uint32_type, },
90 	{ "sco_sent",	&ng_parse_uint32_type, },
91 	{ "bytes_recv",	&ng_parse_uint32_type, },
92 	{ "bytes_sent",	&ng_parse_uint32_type, },
93 	{ NULL, }
94 };
95 static const struct ng_parse_type		ng_hci_stat_type = {
96 	&ng_parse_struct_type,
97 	&ng_hci_stat_type_fields
98 };
99 
100 /*
101  * HCI node command list
102  */
103 
104 static const struct ng_cmdlist	ng_hci_cmdlist[] = {
105 	{
106 		NGM_HCI_COOKIE,
107 		NGM_HCI_NODE_GET_STATE,
108 		"get_state",
109 		NULL,
110 		&ng_parse_uint16_type
111 	},
112 	{
113 		NGM_HCI_COOKIE,
114 		NGM_HCI_NODE_INIT,
115 		"init",
116 		NULL,
117 		NULL
118 	},
119 	{
120 		NGM_HCI_COOKIE,
121 		NGM_HCI_NODE_GET_DEBUG,
122 		"get_debug",
123 		NULL,
124 		&ng_parse_uint16_type
125 	},
126 	{
127 		NGM_HCI_COOKIE,
128 		NGM_HCI_NODE_SET_DEBUG,
129 		"set_debug",
130 		&ng_parse_uint16_type,
131 		NULL
132 	},
133 	{
134 		NGM_HCI_COOKIE,
135 		NGM_HCI_NODE_GET_BUFFER,
136 		"get_buff_info",
137 		NULL,
138 		&ng_hci_buffer_type
139 	},
140 	{
141 		NGM_HCI_COOKIE,
142 		NGM_HCI_NODE_GET_BDADDR,
143 		"get_bdaddr",
144 		NULL,
145 		&ng_hci_bdaddr_type
146 	},
147 	{
148 		NGM_HCI_COOKIE,
149 		NGM_HCI_NODE_GET_FEATURES,
150 		"get_features",
151 		NULL,
152 		&ng_hci_features_type
153 	},
154 	{
155 		NGM_HCI_COOKIE,
156 		NGM_HCI_NODE_GET_STAT,
157 		"get_stat",
158 		NULL,
159 		&ng_hci_stat_type
160 	},
161 	{
162 		NGM_HCI_COOKIE,
163 		NGM_HCI_NODE_RESET_STAT,
164 		"reset_stat",
165 		NULL,
166 		NULL
167 	},
168 	{
169 		NGM_HCI_COOKIE,
170 		NGM_HCI_NODE_FLUSH_NEIGHBOR_CACHE,
171 		"flush_ncache",
172 		NULL,
173 		NULL
174 	},
175 	{
176 		NGM_HCI_COOKIE,
177 		NGM_HCI_NODE_GET_LINK_POLICY_SETTINGS_MASK,
178 		"get_lm_mask",
179 		NULL,
180 		&ng_parse_uint16_type
181 	},
182 	{
183 		NGM_HCI_COOKIE,
184 		NGM_HCI_NODE_SET_LINK_POLICY_SETTINGS_MASK,
185 		"set_lm_mask",
186 		&ng_parse_uint16_type,
187 		NULL
188 	},
189 	{
190 		NGM_HCI_COOKIE,
191 		NGM_HCI_NODE_GET_PACKET_MASK,
192 		"get_pkt_mask",
193 		NULL,
194 		&ng_parse_uint16_type
195 	},
196 	{
197 		NGM_HCI_COOKIE,
198 		NGM_HCI_NODE_SET_PACKET_MASK,
199 		"set_pkt_mask",
200 		&ng_parse_uint16_type,
201 		NULL
202 	},
203 	{
204 		NGM_HCI_COOKIE,
205 		NGM_HCI_NODE_GET_ROLE_SWITCH,
206 		"get_role_sw",
207 		NULL,
208 		&ng_parse_uint16_type
209 	},
210 	{
211 		NGM_HCI_COOKIE,
212 		NGM_HCI_NODE_SET_ROLE_SWITCH,
213 		"set_role_sw",
214 		&ng_parse_uint16_type,
215 		NULL
216 	},
217 	{ 0, }
218 };
219 
220 #endif /* ndef _NETGRAPH_HCI_PRSE_H_ */
221