Lines Matching refs:con

71 	ng_l2cap_con_p		 con = NULL;
75 con = ng_l2cap_con_by_addr(l2cap, bdaddr, type);
76 if (con != NULL) {
80 __func__, NG_NODE_NAME(l2cap->node), con->state,
81 con->con_handle);
96 con = ng_l2cap_new_con(l2cap, bdaddr, type);
97 if (con == NULL)
104 ng_l2cap_free_con(con);
113 con->flags |= NG_L2CAP_CON_OUTGOING;
114 con->state = NG_L2CAP_W4_LP_CON_CFM;
115 ng_l2cap_lp_timeout(con);
119 if (ng_l2cap_lp_untimeout(con) == 0)
120 ng_l2cap_free_con(con);
142 ng_l2cap_con_p con = NULL;
156 con = ng_l2cap_con_by_addr(l2cap, &ep->bdaddr, ep->link_type);
157 if (con == NULL) {
166 if (con->state != NG_L2CAP_W4_LP_CON_CFM) {
170 __func__, NG_NODE_NAME(l2cap->node), con->state,
171 con->con_handle);
183 if ((error = ng_l2cap_lp_untimeout(con)) != 0)
187 con->state = NG_L2CAP_CON_OPEN;
188 con->con_handle = ep->con_handle;
189 ng_l2cap_lp_deliver(con);
191 ng_l2cap_con_fail(con, ep->status);
211 ng_l2cap_con_p con = NULL;
226 con = ng_l2cap_con_by_addr(l2cap, &ep->bdaddr, ep->link_type);
227 if (con != NULL) {
231 __func__, NG_NODE_NAME(l2cap->node), con->state,
232 con->con_handle);
247 con = ng_l2cap_new_con(l2cap, &ep->bdaddr, ep->link_type);
248 if (con == NULL)
255 ng_l2cap_free_con(con);
265 con->state = NG_L2CAP_W4_LP_CON_CFM;
266 ng_l2cap_lp_timeout(con);
270 if (ng_l2cap_lp_untimeout(con) == 0)
271 ng_l2cap_free_con(con);
292 ng_l2cap_con_p con = NULL;
307 con = ng_l2cap_con_by_handle(l2cap, ep->con_handle);
308 if (con == NULL) {
318 if (con->state != NG_L2CAP_CON_OPEN) {
322 __func__, NG_NODE_NAME(l2cap->node), con->state,
323 con->con_handle);
335 if (con->flags & NG_L2CAP_CON_AUTO_DISCON_TIMO)
336 if ((error = ng_l2cap_discon_untimeout(con)) != 0)
339 ng_l2cap_con_fail(con, ep->reason);
354 ng_l2cap_con_p con = NULL;
358 con = ng_l2cap_con_by_handle(l2cap, con_handle);
359 if (con == NULL) {
369 if (con->state != NG_L2CAP_CON_OPEN) {
373 __func__, NG_NODE_NAME(l2cap->node), con->state,
374 con->con_handle);
443 ng_l2cap_con_p con = NULL;
458 con = ng_l2cap_con_by_handle(l2cap, ep->con_handle);
459 if (con == NULL) {
469 if (con->state != NG_L2CAP_CON_OPEN) {
473 __func__, NG_NODE_NAME(l2cap->node), con->state,
474 con->con_handle);
488 ng_l2cap_con_p con = NULL;
503 con = ng_l2cap_con_by_handle(l2cap, ep->con_handle);
504 if (con == NULL) {
514 if (con->state != NG_L2CAP_CON_OPEN) {
518 __func__, NG_NODE_NAME(l2cap->node), con->state,
519 con->con_handle);
524 con->encryption = ep->status;
527 if((ch->con->con_handle == ep->con_handle) &&
528 (ch->con->linktype == ep->link_type))
542 ng_l2cap_lp_send(ng_l2cap_con_p con, u_int16_t dcid, struct mbuf *m0)
544 ng_l2cap_p l2cap = con->l2cap;
550 KASSERT((con->tx_pkt == NULL),
607 con->con_handle, flag, 0));
612 if (con->tx_pkt == NULL)
613 con->tx_pkt = m_last = m0;
621 __func__, NG_NODE_NAME(l2cap->node), con->con_handle,
634 while (con->tx_pkt != NULL) {
635 m = con->tx_pkt->m_nextpkt;
636 m_freem(con->tx_pkt);
637 con->tx_pkt = m;
662 ng_l2cap_con_p con = NULL;
694 con = ng_l2cap_con_by_handle(l2cap, con_handle);
695 if (con == NULL) {
705 if (con->state != NG_L2CAP_CON_OPEN) {
708 __func__, NG_NODE_NAME(l2cap->node), con->state);
715 if (con->rx_pkt != NULL) {
719 con->rx_pkt->m_pkthdr.len, con->rx_pkt_len);
720 NG_FREE_M(con->rx_pkt);
721 con->rx_pkt_len = 0;
746 con->rx_pkt = m;
747 con->rx_pkt_len = le16toh(l2cap_hdr->length)+sizeof(*l2cap_hdr);
749 if (con->rx_pkt == NULL) {
753 con->con_handle);
758 m_cat(con->rx_pkt, m);
759 con->rx_pkt->m_pkthdr.len += length;
768 con->rx_pkt_len -= length;
769 if (con->rx_pkt_len < 0) {
773 con->rx_pkt->m_pkthdr.len, con->rx_pkt_len);
774 NG_FREE_M(con->rx_pkt);
775 con->rx_pkt_len = 0;
776 } else if (con->rx_pkt_len == 0) {
778 error = ng_l2cap_receive(con);
779 con->rx_pkt = NULL;
780 con->rx_pkt_len = 0;
796 ng_l2cap_lp_deliver(ng_l2cap_con_p con)
798 ng_l2cap_p l2cap = con->l2cap;
803 if (con->state != NG_L2CAP_CON_OPEN)
806 if (con->tx_pkt == NULL)
807 ng_l2cap_con_wakeup(con);
809 if (con->tx_pkt == NULL)
822 while (con->pending < con->l2cap->num_pkts && con->tx_pkt != NULL) {
823 m = con->tx_pkt;
824 con->tx_pkt = con->tx_pkt->m_nextpkt;
828 ng_l2cap_lp_receive(con->l2cap, m);
833 __func__, NG_NODE_NAME(l2cap->node), con->con_handle,
841 con->con_handle, error);
846 con->pending ++;
851 __func__, NG_NODE_NAME(l2cap->node), con->pending,
852 con->con_handle);
857 while (con->tx_pkt != NULL) {
858 m = con->tx_pkt->m_nextpkt;
859 m_freem(con->tx_pkt);
860 con->tx_pkt = m;
874 ng_l2cap_con_p con = NULL;
882 con = ng_l2cap_con_by_handle(l2cap, con_handle);
884 if (con == NULL) {
891 if (!(con->flags & NG_L2CAP_CON_LP_TIMO)) {
894 __func__, NG_NODE_NAME(node), con_handle, con->state,
895 con->flags);
904 con->flags &= ~NG_L2CAP_CON_LP_TIMO;
905 ng_l2cap_con_fail(con, NG_L2CAP_TIMEOUT);
917 ng_l2cap_con_p con = NULL;
928 con = ng_l2cap_con_by_handle(l2cap, con_handle);
930 if (con == NULL) {
937 if (!(con->flags & NG_L2CAP_CON_AUTO_DISCON_TIMO)) {
940 __func__, NG_NODE_NAME(node), con_handle, con->state,
941 con->flags);
945 con->flags &= ~NG_L2CAP_CON_AUTO_DISCON_TIMO;
962 ep->con_handle = con->con_handle;