Changeset View
Changeset View
Standalone View
Standalone View
sys/netgraph/bluetooth/hci/ng_hci_main.c
Show First 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | static struct ng_type typestruct = { | ||||
.rcvdata = ng_hci_drv_rcvdata, | .rcvdata = ng_hci_drv_rcvdata, | ||||
.disconnect = ng_hci_disconnect, | .disconnect = ng_hci_disconnect, | ||||
.cmdlist = ng_hci_cmdlist, | .cmdlist = ng_hci_cmdlist, | ||||
}; | }; | ||||
NETGRAPH_INIT(hci, &typestruct); | NETGRAPH_INIT(hci, &typestruct); | ||||
MODULE_VERSION(ng_hci, NG_BLUETOOTH_VERSION); | MODULE_VERSION(ng_hci, NG_BLUETOOTH_VERSION); | ||||
MODULE_DEPEND(ng_hci, ng_bluetooth, NG_BLUETOOTH_VERSION, | MODULE_DEPEND(ng_hci, ng_bluetooth, NG_BLUETOOTH_VERSION, | ||||
NG_BLUETOOTH_VERSION, NG_BLUETOOTH_VERSION); | NG_BLUETOOTH_VERSION, NG_BLUETOOTH_VERSION); | ||||
static int ng_hci_linktype_to_addrtype(int linktype); | |||||
static int ng_hci_linktype_to_addrtype(int linktype) | |||||
{ | |||||
switch(linktype){ | |||||
case NG_HCI_LINK_LE_PUBLIC: | |||||
return BDADDR_LE_PUBLIC; | |||||
case NG_HCI_LINK_LE_RANDOM: | |||||
return BDADDR_LE_RANDOM; | |||||
case NG_HCI_LINK_ACL: | |||||
/*FALLTHROUGH*/ | |||||
default: | |||||
return BDADDR_BREDR; | |||||
} | |||||
return BDADDR_BREDR; | |||||
} | |||||
/***************************************************************************** | /***************************************************************************** | ||||
***************************************************************************** | ***************************************************************************** | ||||
** Netgraph methods implementation | ** Netgraph methods implementation | ||||
***************************************************************************** | ***************************************************************************** | ||||
*****************************************************************************/ | *****************************************************************************/ | ||||
/* | /* | ||||
* Create new instance of HCI node (new unit) | * Create new instance of HCI node (new unit) | ||||
▲ Show 20 Lines • Show All 371 Lines • ▼ Show 20 Lines | case NGM_HCI_NODE_GET_NEIGHBOR_CACHE: { | ||||
e2 = (ng_hci_node_neighbor_cache_entry_ep *)(e1 + 1); | e2 = (ng_hci_node_neighbor_cache_entry_ep *)(e1 + 1); | ||||
e1->num_entries = s; | e1->num_entries = s; | ||||
LIST_FOREACH(n, &unit->neighbors, next) { | LIST_FOREACH(n, &unit->neighbors, next) { | ||||
e2->page_scan_rep_mode = n->page_scan_rep_mode; | e2->page_scan_rep_mode = n->page_scan_rep_mode; | ||||
e2->page_scan_mode = n->page_scan_mode; | e2->page_scan_mode = n->page_scan_mode; | ||||
e2->clock_offset = n->clock_offset; | e2->clock_offset = n->clock_offset; | ||||
e2->addrtype = | |||||
ng_hci_linktype_to_addrtype(n->addrtype); | |||||
e2->extinq_size = n->extinq_size; | |||||
bcopy(&n->bdaddr, &e2->bdaddr, | bcopy(&n->bdaddr, &e2->bdaddr, | ||||
sizeof(e2->bdaddr)); | sizeof(e2->bdaddr)); | ||||
bcopy(&n->features, &e2->features, | bcopy(&n->features, &e2->features, | ||||
sizeof(e2->features)); | sizeof(e2->features)); | ||||
bcopy(&n->extinq_data, &e2->extinq_data, | |||||
n->extinq_size); | |||||
e2 ++; | e2 ++; | ||||
if (--s <= 0) | if (--s <= 0) | ||||
break; | break; | ||||
} | } | ||||
} break; | } break; | ||||
/* Get connection list */ | /* Get connection list */ | ||||
case NGM_HCI_NODE_GET_CON_LIST: { | case NGM_HCI_NODE_GET_CON_LIST: { | ||||
▲ Show 20 Lines • Show All 587 Lines • Show Last 20 Lines |