Lines Matching refs:con

253 	ng_hci_unit_con_p	con = NULL, winner = NULL;
267 LIST_FOREACH(con, &unit->con_list, next) {
268 reallink_type = (con->link_type == NG_HCI_LINK_SCO)?
273 if (NG_BT_ITEMQ_LEN(&con->conq) == 0)
276 if (con->pending < min_pending) {
277 winner = con;
278 min_pending = con->pending;
349 sync_con_queue(ng_hci_unit_p unit, ng_hci_unit_con_p con, int completed)
356 hook = (con->link_type != NG_HCI_LINK_SCO)? unit->acl : unit->sco;
366 state->con_handle = con->con_handle;
453 ng_hci_unit_con_p con = NULL;
467 * 1) con->link_type == link_type
468 * 2) con->state == NG_HCI_CON_W4_CONN_COMPLETE
469 * 3) con->bdaddr == ep->address
471 LIST_FOREACH(con, &unit->con_list, next)
472 if (con->link_type == link_type &&
473 con->state == NG_HCI_CON_W4_CONN_COMPLETE &&
474 bcmp(&con->bdaddr, &ep->address, sizeof(bdaddr_t)) == 0)
494 if (con == NULL) {
498 con = ng_hci_new_con(unit, link_type);
499 if (con == NULL) {
504 con->state = NG_HCI_CON_W4_LP_CON_RSP;
505 ng_hci_con_timeout(con);
507 bcopy(&ep->address, &con->bdaddr, sizeof(con->bdaddr));
508 error = ng_hci_lp_con_ind(con, uclass);
510 ng_hci_con_untimeout(con);
511 ng_hci_free_con(con);
514 } else if ((error = ng_hci_con_untimeout(con)) != 0)
522 con->con_handle = NG_HCI_CON_HANDLE(le16toh(ep->handle));
523 con->encryption_mode = NG_HCI_ENCRYPTION_MODE_NONE;
525 ng_hci_lp_con_cfm(con, ep->status);
529 ng_hci_free_con(con);
531 con->state = NG_HCI_CON_OPEN;
657 ng_hci_unit_con_p con = NULL;
669 * 1) con->link_type == ep->link_type
670 * 2) con->state == NG_HCI_CON_W4_CONN_COMPLETE
671 * 3) con->bdaddr == ep->bdaddr
674 LIST_FOREACH(con, &unit->con_list, next)
675 if (con->link_type == ep->link_type &&
676 con->state == NG_HCI_CON_W4_CONN_COMPLETE &&
677 bcmp(&con->bdaddr, &ep->bdaddr, sizeof(bdaddr_t)) == 0)
696 if (con == NULL) {
700 con = ng_hci_new_con(unit, ep->link_type);
701 if (con == NULL) {
706 bcopy(&ep->bdaddr, &con->bdaddr, sizeof(con->bdaddr));
707 } else if ((error = ng_hci_con_untimeout(con)) != 0)
715 con->con_handle = NG_HCI_CON_HANDLE(le16toh(ep->con_handle));
716 con->encryption_mode = ep->encryption_mode;
718 ng_hci_lp_con_cfm(con, ep->status);
722 ng_hci_free_con(con);
724 con->state = NG_HCI_CON_OPEN;
783 ng_hci_unit_con_p con = NULL;
795 * 1) con->link_type == ep->link_type
797 * 2) con->state == NG_HCI_CON_W4_LP_CON_RSP ||
798 * con->state == NG_HCI_CON_W4_CONN_COMPL
800 * 3) con->bdaddr == ep->bdaddr
834 LIST_FOREACH(con, &unit->con_list, next)
835 if (con->link_type == ep->link_type &&
836 (con->state == NG_HCI_CON_W4_LP_CON_RSP ||
837 con->state == NG_HCI_CON_W4_CONN_COMPLETE) &&
838 bcmp(&con->bdaddr, &ep->bdaddr, sizeof(bdaddr_t)) == 0)
841 if (con == NULL) {
842 con = ng_hci_new_con(unit, ep->link_type);
843 if (con != NULL) {
844 bcopy(&ep->bdaddr, &con->bdaddr, sizeof(con->bdaddr));
846 con->state = NG_HCI_CON_W4_LP_CON_RSP;
847 ng_hci_con_timeout(con);
849 error = ng_hci_lp_con_ind(con, ep->uclass);
851 ng_hci_con_untimeout(con);
852 ng_hci_free_con(con);
868 ng_hci_unit_con_p con = NULL;
887 con = ng_hci_con_by_handle(unit, h);
888 if (con != NULL) {
889 error = ng_hci_lp_discon_ind(con, ep->reason);
892 if (con->flags & NG_HCI_CON_TIMEOUT_PENDING)
893 ng_hci_con_untimeout(con);
895 ng_hci_free_con(con);
914 ng_hci_unit_con_p con = NULL;
924 con = ng_hci_con_by_handle(unit, h);
927 if (con == NULL) {
932 } else if (con->link_type == NG_HCI_LINK_SCO) {
936 con->link_type);
940 con->encryption_mode = NG_HCI_ENCRYPTION_MODE_P2P;
942 con->encryption_mode = NG_HCI_ENCRYPTION_MODE_NONE;
949 ng_hci_lp_enc_change(con, con->encryption_mode);
961 ng_hci_unit_con_p con = NULL;
975 con = ng_hci_con_by_handle(unit, h);
976 if (con == NULL) {
985 n = ng_hci_get_neighbor(unit, &con->bdaddr, NG_HCI_LINK_ACL);
993 bcopy(&con->bdaddr, &n->bdaddr, sizeof(n->bdaddr));
1014 ng_hci_unit_con_p con = NULL;
1026 con = ng_hci_con_by_handle(unit, h);
1027 if (con == NULL) {
1032 } else if (con->link_type != NG_HCI_LINK_ACL) {
1035 __func__, NG_NODE_NAME(unit->node), con->link_type, h);
1037 } else if (con->state != NG_HCI_CON_OPEN) {
1041 con->state, h);
1044 error = ng_hci_lp_qos_cfm(con, ep->status);
1069 ng_hci_unit_con_p con = NULL;
1079 con = ng_hci_con_by_bdaddr(unit, &ep->bdaddr, NG_HCI_LINK_ACL);
1080 if (con != NULL)
1081 con->role = ep->role;
1106 ng_hci_unit_con_p con = NULL;
1128 con = ng_hci_con_by_handle(unit, h);
1129 if (con != NULL) {
1130 con->pending -= p;
1131 if (con->pending < 0) {
1135 con->con_handle, con->pending, p);
1137 con->pending = 0;
1141 if (con->link_type != NG_HCI_LINK_SCO)
1164 ng_hci_unit_con_p con = NULL;
1176 con = ng_hci_con_by_handle(unit, h);
1177 if (con == NULL) {
1182 } else if (con->link_type != NG_HCI_LINK_ACL) {
1186 con->link_type);
1189 con->mode = ep->unit_mode;
1219 ng_hci_unit_con_p con = NULL;
1232 con = ng_hci_con_by_handle(unit, h);
1233 if (con == NULL) {
1242 n = ng_hci_get_neighbor(unit, &con->bdaddr, NG_HCI_LINK_ACL);
1250 bcopy(&con->bdaddr, &n->bdaddr, sizeof(n->bdaddr));
1271 ng_hci_unit_con_p con = NULL;
1283 con = ng_hci_con_by_handle(unit, h);
1284 if (con == NULL) {
1289 } else if (con->link_type != NG_HCI_LINK_ACL) {
1292 __func__, NG_NODE_NAME(unit->node), con->link_type);
1294 } else if (con->state != NG_HCI_CON_OPEN) {
1297 __func__, NG_NODE_NAME(unit->node), con->state, h);
1300 error = ng_hci_lp_qos_ind(con);