Lines Matching defs:con

256 	ng_hci_unit_con_p	con = NULL, winner = NULL;
270 LIST_FOREACH(con, &unit->con_list, next) {
271 reallink_type = (con->link_type == NG_HCI_LINK_SCO)?
276 if (NG_BT_ITEMQ_LEN(&con->conq) == 0)
279 if (con->pending < min_pending) {
280 winner = con;
281 min_pending = con->pending;
352 sync_con_queue(ng_hci_unit_p unit, ng_hci_unit_con_p con, int completed)
359 hook = (con->link_type != NG_HCI_LINK_SCO)? unit->acl : unit->sco;
369 state->con_handle = con->con_handle;
476 ng_hci_unit_con_p con = NULL;
490 * 1) con->link_type == link_type
491 * 2) con->state == NG_HCI_CON_W4_CONN_COMPLETE
492 * 3) con->bdaddr == ep->address
494 LIST_FOREACH(con, &unit->con_list, next)
495 if (con->link_type == link_type &&
496 con->state == NG_HCI_CON_W4_CONN_COMPLETE &&
497 bcmp(&con->bdaddr, &ep->address, sizeof(bdaddr_t)) == 0)
517 if (con == NULL) {
521 con = ng_hci_new_con(unit, link_type);
522 if (con == NULL) {
527 con->state = NG_HCI_CON_W4_LP_CON_RSP;
528 ng_hci_con_timeout(con);
530 bcopy(&ep->address, &con->bdaddr, sizeof(con->bdaddr));
531 error = ng_hci_lp_con_ind(con, uclass);
533 ng_hci_con_untimeout(con);
534 ng_hci_free_con(con);
538 } else if ((error = ng_hci_con_untimeout(con)) != 0)
546 con->con_handle = NG_HCI_CON_HANDLE(le16toh(ep->handle));
547 con->encryption_mode = NG_HCI_ENCRYPTION_MODE_NONE;
549 ng_hci_lp_con_cfm(con, ep->status);
553 ng_hci_free_con(con);
555 con->state = NG_HCI_CON_OPEN;
680 ng_hci_unit_con_p con = NULL;
692 * 1) con->link_type == ep->link_type
693 * 2) con->state == NG_HCI_CON_W4_CONN_COMPLETE
694 * 3) con->bdaddr == ep->bdaddr
697 LIST_FOREACH(con, &unit->con_list, next)
698 if (con->link_type == ep->link_type &&
699 con->state == NG_HCI_CON_W4_CONN_COMPLETE &&
700 bcmp(&con->bdaddr, &ep->bdaddr, sizeof(bdaddr_t)) == 0)
719 if (con == NULL) {
723 con = ng_hci_new_con(unit, ep->link_type);
724 if (con == NULL) {
729 bcopy(&ep->bdaddr, &con->bdaddr, sizeof(con->bdaddr));
730 } else if ((error = ng_hci_con_untimeout(con)) != 0)
738 con->con_handle = NG_HCI_CON_HANDLE(le16toh(ep->con_handle));
739 con->encryption_mode = ep->encryption_mode;
741 ng_hci_lp_con_cfm(con, ep->status);
745 ng_hci_free_con(con);
747 con->state = NG_HCI_CON_OPEN;
806 ng_hci_unit_con_p con = NULL;
818 * 1) con->link_type == ep->link_type
820 * 2) con->state == NG_HCI_CON_W4_LP_CON_RSP ||
821 * con->state == NG_HCI_CON_W4_CONN_COMPL
823 * 3) con->bdaddr == ep->bdaddr
857 LIST_FOREACH(con, &unit->con_list, next)
858 if (con->link_type == ep->link_type &&
859 (con->state == NG_HCI_CON_W4_LP_CON_RSP ||
860 con->state == NG_HCI_CON_W4_CONN_COMPLETE) &&
861 bcmp(&con->bdaddr, &ep->bdaddr, sizeof(bdaddr_t)) == 0)
864 if (con == NULL) {
865 con = ng_hci_new_con(unit, ep->link_type);
866 if (con != NULL) {
867 bcopy(&ep->bdaddr, &con->bdaddr, sizeof(con->bdaddr));
869 con->state = NG_HCI_CON_W4_LP_CON_RSP;
870 ng_hci_con_timeout(con);
872 error = ng_hci_lp_con_ind(con, ep->uclass);
874 ng_hci_con_untimeout(con);
875 ng_hci_free_con(con);
891 ng_hci_unit_con_p con = NULL;
910 con = ng_hci_con_by_handle(unit, h);
911 if (con != NULL) {
912 error = ng_hci_lp_discon_ind(con, ep->reason);
915 if (con->flags & NG_HCI_CON_TIMEOUT_PENDING)
916 ng_hci_con_untimeout(con);
918 ng_hci_free_con(con);
937 ng_hci_unit_con_p con = NULL;
947 con = ng_hci_con_by_handle(unit, h);
950 if (con == NULL) {
955 } else if (con->link_type == NG_HCI_LINK_SCO) {
959 con->link_type);
963 con->encryption_mode = NG_HCI_ENCRYPTION_MODE_P2P;
965 con->encryption_mode = NG_HCI_ENCRYPTION_MODE_NONE;
972 ng_hci_lp_enc_change(con, con->encryption_mode);
984 ng_hci_unit_con_p con = NULL;
998 con = ng_hci_con_by_handle(unit, h);
999 if (con == NULL) {
1008 n = ng_hci_get_neighbor(unit, &con->bdaddr, NG_HCI_LINK_ACL);
1016 bcopy(&con->bdaddr, &n->bdaddr, sizeof(n->bdaddr));
1037 ng_hci_unit_con_p con = NULL;
1049 con = ng_hci_con_by_handle(unit, h);
1050 if (con == NULL) {
1055 } else if (con->link_type != NG_HCI_LINK_ACL) {
1058 __func__, NG_NODE_NAME(unit->node), con->link_type, h);
1060 } else if (con->state != NG_HCI_CON_OPEN) {
1064 con->state, h);
1067 error = ng_hci_lp_qos_cfm(con, ep->status);
1092 ng_hci_unit_con_p con = NULL;
1102 con = ng_hci_con_by_bdaddr(unit, &ep->bdaddr, NG_HCI_LINK_ACL);
1103 if (con != NULL)
1104 con->role = ep->role;
1129 ng_hci_unit_con_p con = NULL;
1151 con = ng_hci_con_by_handle(unit, h);
1152 if (con != NULL) {
1153 con->pending -= p;
1154 if (con->pending < 0) {
1158 con->con_handle, con->pending, p);
1160 con->pending = 0;
1164 if (con->link_type != NG_HCI_LINK_SCO)
1187 ng_hci_unit_con_p con = NULL;
1199 con = ng_hci_con_by_handle(unit, h);
1200 if (con == NULL) {
1205 } else if (con->link_type != NG_HCI_LINK_ACL) {
1209 con->link_type);
1212 con->mode = ep->unit_mode;
1242 ng_hci_unit_con_p con = NULL;
1255 con = ng_hci_con_by_handle(unit, h);
1256 if (con == NULL) {
1265 n = ng_hci_get_neighbor(unit, &con->bdaddr, NG_HCI_LINK_ACL);
1273 bcopy(&con->bdaddr, &n->bdaddr, sizeof(n->bdaddr));
1294 ng_hci_unit_con_p con = NULL;
1306 con = ng_hci_con_by_handle(unit, h);
1307 if (con == NULL) {
1312 } else if (con->link_type != NG_HCI_LINK_ACL) {
1315 __func__, NG_NODE_NAME(unit->node), con->link_type);
1317 } else if (con->state != NG_HCI_CON_OPEN) {
1320 __func__, NG_NODE_NAME(unit->node), con->state, h);
1323 error = ng_hci_lp_qos_ind(con);