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