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