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