Lines Matching full:ch
68 ng_l2cap_chan_p ch = NULL; in ng_l2cap_l2ca_con_req() local
107 ch = ng_l2cap_new_chan(l2cap, con, ip->psm, ip->idtype); in ng_l2cap_l2ca_con_req()
108 if (ch == NULL) { in ng_l2cap_l2ca_con_req()
114 cmd = ng_l2cap_new_cmd(ch->con, ch, ng_l2cap_get_ident(con), in ng_l2cap_l2ca_con_req()
117 ng_l2cap_free_chan(ch); in ng_l2cap_l2ca_con_req()
124 ng_l2cap_free_chan(ch); in ng_l2cap_l2ca_con_req()
139 _ng_l2cap_con_req(cmd->aux, cmd->ident, ch->psm, ch->scid); in ng_l2cap_l2ca_con_req()
143 ng_l2cap_free_chan(ch); in ng_l2cap_l2ca_con_req()
148 ch->state = NG_L2CAP_W4_L2CAP_CON_RSP; in ng_l2cap_l2ca_con_req()
151 ng_l2cap_link_cmd(ch->con, cmd); in ng_l2cap_l2ca_con_req()
152 ng_l2cap_lp_deliver(ch->con); in ng_l2cap_l2ca_con_req()
162 ng_l2cap_l2ca_con_rsp(ng_l2cap_chan_p ch, u_int32_t token, u_int16_t result, in ng_l2cap_l2ca_con_rsp() argument
165 ng_l2cap_p l2cap = ch->con->l2cap; in ng_l2cap_l2ca_con_rsp()
175 __func__, NG_NODE_NAME(l2cap->node), ch->psm); in ng_l2cap_l2ca_con_rsp()
196 if(ch->scid == NG_L2CAP_ATT_CID){ in ng_l2cap_l2ca_con_rsp()
198 op->lcid = ch->con->con_handle; in ng_l2cap_l2ca_con_rsp()
199 }else if(ch->scid == NG_L2CAP_SMP_CID){ in ng_l2cap_l2ca_con_rsp()
201 op->lcid = ch->con->con_handle; in ng_l2cap_l2ca_con_rsp()
203 op->idtype = (ch->con->linktype == NG_HCI_LINK_ACL)? in ng_l2cap_l2ca_con_rsp()
206 op->lcid = ch->scid; in ng_l2cap_l2ca_con_rsp()
208 op->encryption = ch->con->encryption; in ng_l2cap_l2ca_con_rsp()
227 ng_l2cap_chan_p ch = NULL; in ng_l2cap_l2ca_con_rsp_req() local
247 ch = ng_l2cap_chan_by_scid(l2cap, ip->lcid in ng_l2cap_l2ca_con_rsp_req()
253 ch = NULL; in ng_l2cap_l2ca_con_rsp_req()
255 if (ch == NULL) { in ng_l2cap_l2ca_con_rsp_req()
265 if (ch->state != NG_L2CAP_W4_L2CA_CON_RSP) { in ng_l2cap_l2ca_con_rsp_req()
269 __func__, NG_NODE_NAME(l2cap->node), ch->state, in ng_l2cap_l2ca_con_rsp_req()
275 dcid = ch->dcid; in ng_l2cap_l2ca_con_rsp_req()
276 con = ch->con; in ng_l2cap_l2ca_con_rsp_req()
283 if (ch->ident != ip->ident) in ng_l2cap_l2ca_con_rsp_req()
287 __func__, NG_NODE_NAME(l2cap->node), ch->scid, in ng_l2cap_l2ca_con_rsp_req()
288 ch->ident, ip->ident); in ng_l2cap_l2ca_con_rsp_req()
293 ch->state = ((ch->scid == NG_L2CAP_ATT_CID)|| in ng_l2cap_l2ca_con_rsp_req()
294 (ch->scid == NG_L2CAP_SMP_CID))? in ng_l2cap_l2ca_con_rsp_req()
296 ch->cfg_state = 0; in ng_l2cap_l2ca_con_rsp_req()
303 ng_l2cap_free_chan(ch); in ng_l2cap_l2ca_con_rsp_req()
304 ch = NULL; in ng_l2cap_l2ca_con_rsp_req()
309 cmd = ng_l2cap_new_cmd(con, ch, ip->ident, NG_L2CAP_CON_RSP, in ng_l2cap_l2ca_con_rsp_req()
312 if (ch != NULL) in ng_l2cap_l2ca_con_rsp_req()
313 ng_l2cap_free_chan(ch); in ng_l2cap_l2ca_con_rsp_req()
322 if (ch != NULL) in ng_l2cap_l2ca_con_rsp_req()
323 ng_l2cap_free_chan(ch); in ng_l2cap_l2ca_con_rsp_req()
337 int ng_l2cap_l2ca_encryption_change(ng_l2cap_chan_p ch, uint16_t result) in ng_l2cap_l2ca_encryption_change() argument
339 ng_l2cap_p l2cap = ch->con->l2cap; in ng_l2cap_l2ca_encryption_change()
349 __func__, NG_NODE_NAME(l2cap->node), ch->psm); in ng_l2cap_l2ca_encryption_change()
365 if(ch->scid ==NG_L2CAP_ATT_CID|| in ng_l2cap_l2ca_encryption_change()
366 ch->scid ==NG_L2CAP_SMP_CID){ in ng_l2cap_l2ca_encryption_change()
367 op->lcid = ch->con->con_handle; in ng_l2cap_l2ca_encryption_change()
368 op->idtype = (ch->scid==NG_L2CAP_ATT_CID)? in ng_l2cap_l2ca_encryption_change()
372 op->idtype =(ch->con->linktype ==NG_HCI_LINK_ACL)? in ng_l2cap_l2ca_encryption_change()
389 ng_l2cap_l2ca_con_rsp_rsp(ng_l2cap_chan_p ch, u_int32_t token, u_int16_t result) in ng_l2cap_l2ca_con_rsp_rsp() argument
391 ng_l2cap_p l2cap = ch->con->l2cap; in ng_l2cap_l2ca_con_rsp_rsp()
401 __func__, NG_NODE_NAME(l2cap->node), ch->psm); in ng_l2cap_l2ca_con_rsp_rsp()
429 ng_l2cap_l2ca_con_ind(ng_l2cap_chan_p ch) in ng_l2cap_l2ca_con_ind() argument
431 ng_l2cap_p l2cap = ch->con->l2cap; in ng_l2cap_l2ca_con_ind()
441 __func__, NG_NODE_NAME(l2cap->node), ch->psm); in ng_l2cap_l2ca_con_ind()
454 bcopy(&ch->con->remote, &ip->bdaddr, sizeof(ip->bdaddr)); in ng_l2cap_l2ca_con_ind()
455 ip->lcid = ch->scid; in ng_l2cap_l2ca_con_ind()
456 ip->psm = ch->psm; in ng_l2cap_l2ca_con_ind()
457 ip->ident = ch->ident; in ng_l2cap_l2ca_con_ind()
458 ip->linktype = ch->con->linktype; in ng_l2cap_l2ca_con_ind()
474 ng_l2cap_chan_p ch = NULL; in ng_l2cap_l2ca_cfg_req() local
494 ch = ng_l2cap_chan_by_scid(l2cap, ip->lcid, NG_L2CAP_L2CA_IDTYPE_BREDR); in ng_l2cap_l2ca_cfg_req()
495 if (ch == NULL) { in ng_l2cap_l2ca_cfg_req()
505 if (ch->state != NG_L2CAP_OPEN && ch->state != NG_L2CAP_CONFIG) { in ng_l2cap_l2ca_cfg_req()
509 __func__, NG_NODE_NAME(l2cap->node), ch->state, in ng_l2cap_l2ca_cfg_req()
510 ch->scid); in ng_l2cap_l2ca_cfg_req()
516 ch->imtu = ip->imtu; in ng_l2cap_l2ca_cfg_req()
517 bcopy(&ip->oflow, &ch->oflow, sizeof(ch->oflow)); in ng_l2cap_l2ca_cfg_req()
518 ch->flush_timo = ip->flush_timo; in ng_l2cap_l2ca_cfg_req()
519 ch->link_timo = ip->link_timo; in ng_l2cap_l2ca_cfg_req()
522 if (ch->imtu != NG_L2CAP_MTU_DEFAULT) in ng_l2cap_l2ca_cfg_req()
523 mtu = &ch->imtu; in ng_l2cap_l2ca_cfg_req()
524 if (ch->flush_timo != NG_L2CAP_FLUSH_TIMO_DEFAULT) in ng_l2cap_l2ca_cfg_req()
525 flush_timo = &ch->flush_timo; in ng_l2cap_l2ca_cfg_req()
526 if (bcmp(ng_l2cap_default_flow(), &ch->oflow, sizeof(ch->oflow)) != 0) in ng_l2cap_l2ca_cfg_req()
527 flow = &ch->oflow; in ng_l2cap_l2ca_cfg_req()
537 cmd = ng_l2cap_new_cmd(ch->con, ch, ng_l2cap_get_ident(ch->con), in ng_l2cap_l2ca_cfg_req()
553 _ng_l2cap_cfg_req(cmd->aux, cmd->ident, ch->dcid, 0, opt); in ng_l2cap_l2ca_cfg_req()
561 if (ch->state == NG_L2CAP_OPEN) { in ng_l2cap_l2ca_cfg_req()
562 ch->state = ((ch->scid == NG_L2CAP_ATT_CID)|| in ng_l2cap_l2ca_cfg_req()
563 (ch->scid == NG_L2CAP_SMP_CID))? in ng_l2cap_l2ca_cfg_req()
565 ch->cfg_state = 0; in ng_l2cap_l2ca_cfg_req()
569 ng_l2cap_link_cmd(ch->con, cmd); in ng_l2cap_l2ca_cfg_req()
570 ng_l2cap_lp_deliver(ch->con); in ng_l2cap_l2ca_cfg_req()
580 ng_l2cap_l2ca_cfg_rsp(ng_l2cap_chan_p ch, u_int32_t token, u_int16_t result) in ng_l2cap_l2ca_cfg_rsp() argument
582 ng_l2cap_p l2cap = ch->con->l2cap; in ng_l2cap_l2ca_cfg_rsp()
592 __func__, NG_NODE_NAME(l2cap->node), ch->psm); in ng_l2cap_l2ca_cfg_rsp()
608 op->imtu = ch->imtu; in ng_l2cap_l2ca_cfg_rsp()
609 bcopy(&ch->oflow, &op->oflow, sizeof(op->oflow)); in ng_l2cap_l2ca_cfg_rsp()
610 op->flush_timo = ch->flush_timo; in ng_l2cap_l2ca_cfg_rsp()
615 ch->cfg_state |= NG_L2CAP_CFG_IN; in ng_l2cap_l2ca_cfg_rsp()
617 if (ch->cfg_state == NG_L2CAP_CFG_BOTH) in ng_l2cap_l2ca_cfg_rsp()
618 ch->state = NG_L2CAP_OPEN; in ng_l2cap_l2ca_cfg_rsp()
646 ng_l2cap_chan_p ch = NULL; in ng_l2cap_l2ca_cfg_rsp_req() local
666 ch = ng_l2cap_chan_by_scid(l2cap, ip->lcid, in ng_l2cap_l2ca_cfg_rsp_req()
668 if (ch == NULL) { in ng_l2cap_l2ca_cfg_rsp_req()
678 if (ch->state != NG_L2CAP_CONFIG) { in ng_l2cap_l2ca_cfg_rsp_req()
682 __func__, NG_NODE_NAME(l2cap->node), ch->state, in ng_l2cap_l2ca_cfg_rsp_req()
683 ch->scid); in ng_l2cap_l2ca_cfg_rsp_req()
689 if (ip->omtu != ch->omtu) { in ng_l2cap_l2ca_cfg_rsp_req()
690 ch->omtu = ip->omtu; in ng_l2cap_l2ca_cfg_rsp_req()
691 mtu = &ch->omtu; in ng_l2cap_l2ca_cfg_rsp_req()
694 if (bcmp(&ip->iflow, &ch->iflow, sizeof(ch->iflow)) != 0) { in ng_l2cap_l2ca_cfg_rsp_req()
695 bcopy(&ip->iflow, &ch->iflow, sizeof(ch->iflow)); in ng_l2cap_l2ca_cfg_rsp_req()
696 flow = &ch->iflow; in ng_l2cap_l2ca_cfg_rsp_req()
708 cmd = ng_l2cap_new_cmd(ch->con, ch, ch->ident, NG_L2CAP_CFG_RSP, in ng_l2cap_l2ca_cfg_rsp_req()
716 _ng_l2cap_cfg_rsp(cmd->aux,cmd->ident,ch->dcid,0,NG_L2CAP_SUCCESS,opt); in ng_l2cap_l2ca_cfg_rsp_req()
724 ch->cfg_state |= NG_L2CAP_CFG_OUT; in ng_l2cap_l2ca_cfg_rsp_req()
725 if (ch->cfg_state == NG_L2CAP_CFG_BOTH) in ng_l2cap_l2ca_cfg_rsp_req()
726 ch->state = NG_L2CAP_OPEN; in ng_l2cap_l2ca_cfg_rsp_req()
729 ng_l2cap_link_cmd(ch->con, cmd); in ng_l2cap_l2ca_cfg_rsp_req()
730 ng_l2cap_lp_deliver(ch->con); in ng_l2cap_l2ca_cfg_rsp_req()
740 ng_l2cap_l2ca_cfg_rsp_rsp(ng_l2cap_chan_p ch, u_int32_t token, u_int16_t result) in ng_l2cap_l2ca_cfg_rsp_rsp() argument
742 ng_l2cap_p l2cap = ch->con->l2cap; in ng_l2cap_l2ca_cfg_rsp_rsp()
752 __func__, NG_NODE_NAME(l2cap->node), ch->psm); in ng_l2cap_l2ca_cfg_rsp_rsp()
793 ng_l2cap_l2ca_cfg_ind(ng_l2cap_chan_p ch) in ng_l2cap_l2ca_cfg_ind() argument
795 ng_l2cap_p l2cap = ch->con->l2cap; in ng_l2cap_l2ca_cfg_ind()
805 __func__, NG_NODE_NAME(l2cap->node), ch->psm); in ng_l2cap_l2ca_cfg_ind()
817 ip->lcid = ch->scid; in ng_l2cap_l2ca_cfg_ind()
818 ip->omtu = ch->omtu; in ng_l2cap_l2ca_cfg_ind()
819 bcopy(&ch->iflow, &ip->iflow, sizeof(ip->iflow)); in ng_l2cap_l2ca_cfg_ind()
820 ip->flush_timo = ch->flush_timo; in ng_l2cap_l2ca_cfg_ind()
836 ng_l2cap_chan_p ch = NULL; in ng_l2cap_l2ca_write_req() local
872 ch = ng_l2cap_chan_by_conhandle(l2cap, NG_L2CAP_ATT_CID, in ng_l2cap_l2ca_write_req()
875 ch = ng_l2cap_chan_by_conhandle(l2cap, NG_L2CAP_SMP_CID, in ng_l2cap_l2ca_write_req()
888 ch = ng_l2cap_chan_by_scid(l2cap, l2ca_hdr->lcid, in ng_l2cap_l2ca_write_req()
892 if (ch == NULL) { in ng_l2cap_l2ca_write_req()
900 if (ch->state != NG_L2CAP_OPEN) { in ng_l2cap_l2ca_write_req()
903 __func__, NG_NODE_NAME(l2cap->node), ch->scid, in ng_l2cap_l2ca_write_req()
904 ch->state); in ng_l2cap_l2ca_write_req()
910 cmd = ng_l2cap_new_cmd(ch->con, ch, 0, NGM_L2CAP_L2CA_WRITE, token); in ng_l2cap_l2ca_write_req()
918 ng_l2cap_link_cmd(ch->con, cmd); in ng_l2cap_l2ca_write_req()
919 ng_l2cap_lp_deliver(ch->con); in ng_l2cap_l2ca_write_req()
933 ng_l2cap_l2ca_write_rsp(ng_l2cap_chan_p ch, u_int32_t token, u_int16_t result, in ng_l2cap_l2ca_write_rsp() argument
936 ng_l2cap_p l2cap = ch->con->l2cap; in ng_l2cap_l2ca_write_rsp()
946 __func__, NG_NODE_NAME(l2cap->node), ch->psm); in ng_l2cap_l2ca_write_rsp()
963 if(ch->scid == NG_L2CAP_ATT_CID){ in ng_l2cap_l2ca_write_rsp()
965 op->lcid = ch->con->con_handle; in ng_l2cap_l2ca_write_rsp()
966 }else if(ch->scid == NG_L2CAP_SMP_CID){ in ng_l2cap_l2ca_write_rsp()
968 op->lcid = ch->con->con_handle; in ng_l2cap_l2ca_write_rsp()
970 op->idtype = (ch->con->linktype == NG_HCI_LINK_ACL)? in ng_l2cap_l2ca_write_rsp()
973 op->lcid = ch->scid; in ng_l2cap_l2ca_write_rsp()
992 ng_l2cap_chan_p ch = NULL; in ng_l2cap_l2ca_receive() local
1008 ch = ng_l2cap_chan_by_conhandle(l2cap, NG_L2CAP_ATT_CID, in ng_l2cap_l2ca_receive()
1018 ch = ng_l2cap_chan_by_conhandle(l2cap, NG_L2CAP_SMP_CID, in ng_l2cap_l2ca_receive()
1030 ch = ng_l2cap_chan_by_scid(l2cap, hdr->dcid, idtype); in ng_l2cap_l2ca_receive()
1032 if (ch == NULL) { in ng_l2cap_l2ca_receive()
1042 if (ch->state != NG_L2CAP_OPEN) { in ng_l2cap_l2ca_receive()
1046 __func__, NG_NODE_NAME(l2cap->node), ch->scid, in ng_l2cap_l2ca_receive()
1047 ch->state); in ng_l2cap_l2ca_receive()
1053 if (hdr->length > ch->imtu) { in ng_l2cap_l2ca_receive()
1058 ch->imtu, ch->scid); in ng_l2cap_l2ca_receive()
1073 __func__, NG_NODE_NAME(l2cap->node), ch->psm); in ng_l2cap_l2ca_receive()
1180 ng_l2cap_l2ca_qos_ind(ng_l2cap_chan_p ch) in ng_l2cap_l2ca_qos_ind() argument
1182 ng_l2cap_p l2cap = ch->con->l2cap; in ng_l2cap_l2ca_qos_ind()
1192 __func__, NG_NODE_NAME(l2cap->node), ch->psm); in ng_l2cap_l2ca_qos_ind()
1204 bcopy(&ch->con->remote, &ip->bdaddr, sizeof(ip->bdaddr)); in ng_l2cap_l2ca_qos_ind()
1219 ng_l2cap_chan_p ch = NULL; in ng_l2cap_l2ca_discon_req() local
1237 ch = ng_l2cap_chan_by_conhandle(l2cap, NG_L2CAP_ATT_CID, in ng_l2cap_l2ca_discon_req()
1240 if(ch != NULL){ in ng_l2cap_l2ca_discon_req()
1241 ng_l2cap_free_chan(ch); in ng_l2cap_l2ca_discon_req()
1252 ch = ng_l2cap_chan_by_conhandle(l2cap, NG_L2CAP_SMP_CID, in ng_l2cap_l2ca_discon_req()
1255 if(ch != NULL){ in ng_l2cap_l2ca_discon_req()
1256 ng_l2cap_free_chan(ch); in ng_l2cap_l2ca_discon_req()
1267 ch = ng_l2cap_chan_by_scid(l2cap, ip->lcid, ip->idtype); in ng_l2cap_l2ca_discon_req()
1269 if (ch == NULL) { in ng_l2cap_l2ca_discon_req()
1279 if (ch->state != NG_L2CAP_CONFIG && ch->state != NG_L2CAP_OPEN && in ng_l2cap_l2ca_discon_req()
1280 ch->state != NG_L2CAP_W4_L2CAP_DISCON_RSP) { in ng_l2cap_l2ca_discon_req()
1284 __func__, NG_NODE_NAME(l2cap->node), ch->state, in ng_l2cap_l2ca_discon_req()
1285 ch->scid); in ng_l2cap_l2ca_discon_req()
1291 cmd = ng_l2cap_new_cmd(ch->con, ch, ng_l2cap_get_ident(ch->con), in ng_l2cap_l2ca_discon_req()
1294 ng_l2cap_free_chan(ch); in ng_l2cap_l2ca_discon_req()
1300 ng_l2cap_free_chan(ch); in ng_l2cap_l2ca_discon_req()
1306 _ng_l2cap_discon_req(cmd->aux, cmd->ident, ch->dcid, ch->scid); in ng_l2cap_l2ca_discon_req()
1308 ng_l2cap_free_chan(ch); in ng_l2cap_l2ca_discon_req()
1314 ch->state = NG_L2CAP_W4_L2CAP_DISCON_RSP; in ng_l2cap_l2ca_discon_req()
1317 ng_l2cap_link_cmd(ch->con, cmd); in ng_l2cap_l2ca_discon_req()
1318 ng_l2cap_lp_deliver(ch->con); in ng_l2cap_l2ca_discon_req()
1328 ng_l2cap_l2ca_discon_rsp(ng_l2cap_chan_p ch, u_int32_t token, u_int16_t result) in ng_l2cap_l2ca_discon_rsp() argument
1330 ng_l2cap_p l2cap = ch->con->l2cap; in ng_l2cap_l2ca_discon_rsp()
1340 __func__, NG_NODE_NAME(l2cap->node), ch->psm); in ng_l2cap_l2ca_discon_rsp()
1368 ng_l2cap_l2ca_discon_ind(ng_l2cap_chan_p ch) in ng_l2cap_l2ca_discon_ind() argument
1370 ng_l2cap_p l2cap = ch->con->l2cap; in ng_l2cap_l2ca_discon_ind()
1380 __func__, NG_NODE_NAME(l2cap->node), ch->psm); in ng_l2cap_l2ca_discon_ind()
1392 ip->idtype = ch->idtype; in ng_l2cap_l2ca_discon_ind()
1393 if(ch->idtype == NG_L2CAP_L2CA_IDTYPE_ATT|| in ng_l2cap_l2ca_discon_ind()
1394 ch->idtype == NG_L2CAP_L2CA_IDTYPE_SMP) in ng_l2cap_l2ca_discon_ind()
1395 ip->lcid = ch->con->con_handle; in ng_l2cap_l2ca_discon_ind()
1397 ip->lcid = ch->scid; in ng_l2cap_l2ca_discon_ind()
1444 ng_l2cap_l2ca_grp_add_member_rsp(ng_l2cap_chan_p ch, u_int32_t token, in ng_l2cap_l2ca_grp_add_member_rsp() argument