xref: /dflybsd-src/sys/netgraph7/bluetooth/hci/ng_hci_prse.h (revision e85b99abf6da4a83a7dc495b0ef37ce19864149f)
1*b06ebda0SMatthew Dillon /*
2*b06ebda0SMatthew Dillon  * ng_hci_prse.h
3*b06ebda0SMatthew Dillon  */
4*b06ebda0SMatthew Dillon 
5*b06ebda0SMatthew Dillon /*-
6*b06ebda0SMatthew Dillon  * Copyright (c) 2001 Maksim Yevmenkin <m_evmenkin@yahoo.com>
7*b06ebda0SMatthew Dillon  * All rights reserved.
8*b06ebda0SMatthew Dillon  *
9*b06ebda0SMatthew Dillon  * Redistribution and use in source and binary forms, with or without
10*b06ebda0SMatthew Dillon  * modification, are permitted provided that the following conditions
11*b06ebda0SMatthew Dillon  * are met:
12*b06ebda0SMatthew Dillon  * 1. Redistributions of source code must retain the above copyright
13*b06ebda0SMatthew Dillon  *    notice, this list of conditions and the following disclaimer.
14*b06ebda0SMatthew Dillon  * 2. Redistributions in binary form must reproduce the above copyright
15*b06ebda0SMatthew Dillon  *    notice, this list of conditions and the following disclaimer in the
16*b06ebda0SMatthew Dillon  *    documentation and/or other materials provided with the distribution.
17*b06ebda0SMatthew Dillon  *
18*b06ebda0SMatthew Dillon  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19*b06ebda0SMatthew Dillon  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20*b06ebda0SMatthew Dillon  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21*b06ebda0SMatthew Dillon  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22*b06ebda0SMatthew Dillon  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23*b06ebda0SMatthew Dillon  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24*b06ebda0SMatthew Dillon  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25*b06ebda0SMatthew Dillon  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26*b06ebda0SMatthew Dillon  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27*b06ebda0SMatthew Dillon  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28*b06ebda0SMatthew Dillon  * SUCH DAMAGE.
29*b06ebda0SMatthew Dillon  *
30*b06ebda0SMatthew Dillon  * $Id: ng_hci_prse.h,v 1.2 2003/03/18 00:09:36 max Exp $
31*b06ebda0SMatthew Dillon  * $FreeBSD: src/sys/netgraph/bluetooth/hci/ng_hci_prse.h,v 1.4 2005/01/07 01:45:43 imp Exp $
32*b06ebda0SMatthew Dillon  */
33*b06ebda0SMatthew Dillon 
34*b06ebda0SMatthew Dillon /***************************************************************************
35*b06ebda0SMatthew Dillon  ***************************************************************************
36*b06ebda0SMatthew Dillon  **                  ng_parse definitions for the HCI node
37*b06ebda0SMatthew Dillon  ***************************************************************************
38*b06ebda0SMatthew Dillon  ***************************************************************************/
39*b06ebda0SMatthew Dillon 
40*b06ebda0SMatthew Dillon #ifndef _NETGRAPH_HCI_PRSE_H_
41*b06ebda0SMatthew Dillon #define _NETGRAPH_HCI_PRSE_H_
42*b06ebda0SMatthew Dillon 
43*b06ebda0SMatthew Dillon /* BDADDR */
44*b06ebda0SMatthew Dillon static const struct ng_parse_fixedarray_info	ng_hci_bdaddr_type_info = {
45*b06ebda0SMatthew Dillon 	&ng_parse_uint8_type,
46*b06ebda0SMatthew Dillon 	NG_HCI_BDADDR_SIZE
47*b06ebda0SMatthew Dillon };
48*b06ebda0SMatthew Dillon static const struct ng_parse_type		ng_hci_bdaddr_type = {
49*b06ebda0SMatthew Dillon 	&ng_parse_fixedarray_type,
50*b06ebda0SMatthew Dillon 	&ng_hci_bdaddr_type_info
51*b06ebda0SMatthew Dillon };
52*b06ebda0SMatthew Dillon 
53*b06ebda0SMatthew Dillon /* Features */
54*b06ebda0SMatthew Dillon static const struct ng_parse_fixedarray_info	ng_hci_features_type_info = {
55*b06ebda0SMatthew Dillon 	&ng_parse_uint8_type,
56*b06ebda0SMatthew Dillon 	NG_HCI_FEATURES_SIZE
57*b06ebda0SMatthew Dillon };
58*b06ebda0SMatthew Dillon static const struct ng_parse_type		ng_hci_features_type = {
59*b06ebda0SMatthew Dillon 	&ng_parse_fixedarray_type,
60*b06ebda0SMatthew Dillon 	&ng_hci_features_type_info
61*b06ebda0SMatthew Dillon };
62*b06ebda0SMatthew Dillon 
63*b06ebda0SMatthew Dillon /* Buffer info */
64*b06ebda0SMatthew Dillon static const struct ng_parse_struct_field	ng_hci_buffer_type_fields[] =
65*b06ebda0SMatthew Dillon {
66*b06ebda0SMatthew Dillon 	{ "cmd_free",	&ng_parse_uint8_type,  },
67*b06ebda0SMatthew Dillon 	{ "sco_size",	&ng_parse_uint8_type,  },
68*b06ebda0SMatthew Dillon 	{ "sco_pkts",	&ng_parse_uint16_type, },
69*b06ebda0SMatthew Dillon 	{ "sco_free",	&ng_parse_uint16_type, },
70*b06ebda0SMatthew Dillon 	{ "acl_size",	&ng_parse_uint16_type, },
71*b06ebda0SMatthew Dillon 	{ "acl_pkts",	&ng_parse_uint16_type, },
72*b06ebda0SMatthew Dillon 	{ "acl_free",	&ng_parse_uint16_type, },
73*b06ebda0SMatthew Dillon 	{ NULL, }
74*b06ebda0SMatthew Dillon };
75*b06ebda0SMatthew Dillon static const struct ng_parse_type		ng_hci_buffer_type = {
76*b06ebda0SMatthew Dillon 	&ng_parse_struct_type,
77*b06ebda0SMatthew Dillon 	&ng_hci_buffer_type_fields
78*b06ebda0SMatthew Dillon };
79*b06ebda0SMatthew Dillon 
80*b06ebda0SMatthew Dillon /* Stat info */
81*b06ebda0SMatthew Dillon static const struct ng_parse_struct_field	ng_hci_stat_type_fields[] =
82*b06ebda0SMatthew Dillon {
83*b06ebda0SMatthew Dillon 	{ "cmd_sent",	&ng_parse_uint32_type, },
84*b06ebda0SMatthew Dillon 	{ "evnt_recv",	&ng_parse_uint32_type, },
85*b06ebda0SMatthew Dillon 	{ "acl_recv",	&ng_parse_uint32_type, },
86*b06ebda0SMatthew Dillon 	{ "acl_sent",	&ng_parse_uint32_type, },
87*b06ebda0SMatthew Dillon 	{ "sco_recv",	&ng_parse_uint32_type, },
88*b06ebda0SMatthew Dillon 	{ "sco_sent",	&ng_parse_uint32_type, },
89*b06ebda0SMatthew Dillon 	{ "bytes_recv",	&ng_parse_uint32_type, },
90*b06ebda0SMatthew Dillon 	{ "bytes_sent",	&ng_parse_uint32_type, },
91*b06ebda0SMatthew Dillon 	{ NULL, }
92*b06ebda0SMatthew Dillon };
93*b06ebda0SMatthew Dillon static const struct ng_parse_type		ng_hci_stat_type = {
94*b06ebda0SMatthew Dillon 	&ng_parse_struct_type,
95*b06ebda0SMatthew Dillon 	&ng_hci_stat_type_fields
96*b06ebda0SMatthew Dillon };
97*b06ebda0SMatthew Dillon 
98*b06ebda0SMatthew Dillon /*
99*b06ebda0SMatthew Dillon  * HCI node command list
100*b06ebda0SMatthew Dillon  */
101*b06ebda0SMatthew Dillon 
102*b06ebda0SMatthew Dillon static const struct ng_cmdlist	ng_hci_cmdlist[] = {
103*b06ebda0SMatthew Dillon 	{
104*b06ebda0SMatthew Dillon 		NGM_HCI_COOKIE,
105*b06ebda0SMatthew Dillon 		NGM_HCI_NODE_GET_STATE,
106*b06ebda0SMatthew Dillon 		"get_state",
107*b06ebda0SMatthew Dillon 		NULL,
108*b06ebda0SMatthew Dillon 		&ng_parse_uint16_type
109*b06ebda0SMatthew Dillon 	},
110*b06ebda0SMatthew Dillon 	{
111*b06ebda0SMatthew Dillon 		NGM_HCI_COOKIE,
112*b06ebda0SMatthew Dillon 		NGM_HCI_NODE_INIT,
113*b06ebda0SMatthew Dillon 		"init",
114*b06ebda0SMatthew Dillon 		NULL,
115*b06ebda0SMatthew Dillon 		NULL
116*b06ebda0SMatthew Dillon 	},
117*b06ebda0SMatthew Dillon 	{
118*b06ebda0SMatthew Dillon 		NGM_HCI_COOKIE,
119*b06ebda0SMatthew Dillon 		NGM_HCI_NODE_GET_DEBUG,
120*b06ebda0SMatthew Dillon 		"get_debug",
121*b06ebda0SMatthew Dillon 		NULL,
122*b06ebda0SMatthew Dillon 		&ng_parse_uint16_type
123*b06ebda0SMatthew Dillon 	},
124*b06ebda0SMatthew Dillon 	{
125*b06ebda0SMatthew Dillon 		NGM_HCI_COOKIE,
126*b06ebda0SMatthew Dillon 		NGM_HCI_NODE_SET_DEBUG,
127*b06ebda0SMatthew Dillon 		"set_debug",
128*b06ebda0SMatthew Dillon 		&ng_parse_uint16_type,
129*b06ebda0SMatthew Dillon 		NULL
130*b06ebda0SMatthew Dillon 	},
131*b06ebda0SMatthew Dillon 	{
132*b06ebda0SMatthew Dillon 		NGM_HCI_COOKIE,
133*b06ebda0SMatthew Dillon 		NGM_HCI_NODE_GET_BUFFER,
134*b06ebda0SMatthew Dillon 		"get_buff_info",
135*b06ebda0SMatthew Dillon 		NULL,
136*b06ebda0SMatthew Dillon 		&ng_hci_buffer_type
137*b06ebda0SMatthew Dillon 	},
138*b06ebda0SMatthew Dillon 	{
139*b06ebda0SMatthew Dillon 		NGM_HCI_COOKIE,
140*b06ebda0SMatthew Dillon 		NGM_HCI_NODE_GET_BDADDR,
141*b06ebda0SMatthew Dillon 		"get_bdaddr",
142*b06ebda0SMatthew Dillon 		NULL,
143*b06ebda0SMatthew Dillon 		&ng_hci_bdaddr_type
144*b06ebda0SMatthew Dillon 	},
145*b06ebda0SMatthew Dillon 	{
146*b06ebda0SMatthew Dillon 		NGM_HCI_COOKIE,
147*b06ebda0SMatthew Dillon 		NGM_HCI_NODE_GET_FEATURES,
148*b06ebda0SMatthew Dillon 		"get_features",
149*b06ebda0SMatthew Dillon 		NULL,
150*b06ebda0SMatthew Dillon 		&ng_hci_features_type
151*b06ebda0SMatthew Dillon 	},
152*b06ebda0SMatthew Dillon 	{
153*b06ebda0SMatthew Dillon 		NGM_HCI_COOKIE,
154*b06ebda0SMatthew Dillon 		NGM_HCI_NODE_GET_STAT,
155*b06ebda0SMatthew Dillon 		"get_stat",
156*b06ebda0SMatthew Dillon 		NULL,
157*b06ebda0SMatthew Dillon 		&ng_hci_stat_type
158*b06ebda0SMatthew Dillon 	},
159*b06ebda0SMatthew Dillon 	{
160*b06ebda0SMatthew Dillon 		NGM_HCI_COOKIE,
161*b06ebda0SMatthew Dillon 		NGM_HCI_NODE_RESET_STAT,
162*b06ebda0SMatthew Dillon 		"reset_stat",
163*b06ebda0SMatthew Dillon 		NULL,
164*b06ebda0SMatthew Dillon 		NULL
165*b06ebda0SMatthew Dillon 	},
166*b06ebda0SMatthew Dillon 	{
167*b06ebda0SMatthew Dillon 		NGM_HCI_COOKIE,
168*b06ebda0SMatthew Dillon 		NGM_HCI_NODE_FLUSH_NEIGHBOR_CACHE,
169*b06ebda0SMatthew Dillon 		"flush_ncache",
170*b06ebda0SMatthew Dillon 		NULL,
171*b06ebda0SMatthew Dillon 		NULL
172*b06ebda0SMatthew Dillon 	},
173*b06ebda0SMatthew Dillon 	{
174*b06ebda0SMatthew Dillon 		NGM_HCI_COOKIE,
175*b06ebda0SMatthew Dillon 		NGM_HCI_NODE_GET_LINK_POLICY_SETTINGS_MASK,
176*b06ebda0SMatthew Dillon 		"get_lm_mask",
177*b06ebda0SMatthew Dillon 		NULL,
178*b06ebda0SMatthew Dillon 		&ng_parse_uint16_type
179*b06ebda0SMatthew Dillon 	},
180*b06ebda0SMatthew Dillon 	{
181*b06ebda0SMatthew Dillon 		NGM_HCI_COOKIE,
182*b06ebda0SMatthew Dillon 		NGM_HCI_NODE_SET_LINK_POLICY_SETTINGS_MASK,
183*b06ebda0SMatthew Dillon 		"set_lm_mask",
184*b06ebda0SMatthew Dillon 		&ng_parse_uint16_type,
185*b06ebda0SMatthew Dillon 		NULL
186*b06ebda0SMatthew Dillon 	},
187*b06ebda0SMatthew Dillon 	{
188*b06ebda0SMatthew Dillon 		NGM_HCI_COOKIE,
189*b06ebda0SMatthew Dillon 		NGM_HCI_NODE_GET_PACKET_MASK,
190*b06ebda0SMatthew Dillon 		"get_pkt_mask",
191*b06ebda0SMatthew Dillon 		NULL,
192*b06ebda0SMatthew Dillon 		&ng_parse_uint16_type
193*b06ebda0SMatthew Dillon 	},
194*b06ebda0SMatthew Dillon 	{
195*b06ebda0SMatthew Dillon 		NGM_HCI_COOKIE,
196*b06ebda0SMatthew Dillon 		NGM_HCI_NODE_SET_PACKET_MASK,
197*b06ebda0SMatthew Dillon 		"set_pkt_mask",
198*b06ebda0SMatthew Dillon 		&ng_parse_uint16_type,
199*b06ebda0SMatthew Dillon 		NULL
200*b06ebda0SMatthew Dillon 	},
201*b06ebda0SMatthew Dillon 	{
202*b06ebda0SMatthew Dillon 		NGM_HCI_COOKIE,
203*b06ebda0SMatthew Dillon 		NGM_HCI_NODE_GET_ROLE_SWITCH,
204*b06ebda0SMatthew Dillon 		"get_role_sw",
205*b06ebda0SMatthew Dillon 		NULL,
206*b06ebda0SMatthew Dillon 		&ng_parse_uint16_type
207*b06ebda0SMatthew Dillon 	},
208*b06ebda0SMatthew Dillon 	{
209*b06ebda0SMatthew Dillon 		NGM_HCI_COOKIE,
210*b06ebda0SMatthew Dillon 		NGM_HCI_NODE_SET_ROLE_SWITCH,
211*b06ebda0SMatthew Dillon 		"set_role_sw",
212*b06ebda0SMatthew Dillon 		&ng_parse_uint16_type,
213*b06ebda0SMatthew Dillon 		NULL
214*b06ebda0SMatthew Dillon 	},
215*b06ebda0SMatthew Dillon 	{ 0, }
216*b06ebda0SMatthew Dillon };
217*b06ebda0SMatthew Dillon 
218*b06ebda0SMatthew Dillon #endif /* ndef _NETGRAPH_HCI_PRSE_H_ */
219*b06ebda0SMatthew Dillon 
220