• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-13-stable/sys/netgraph/bluetooth/l2cap/

Lines Matching defs:con

109 	ng_l2cap_con_p	con = NULL;
112 con = malloc(sizeof(*con), M_NETGRAPH_L2CAP,
114 if (con == NULL)
117 con->l2cap = l2cap;
118 con->state = NG_L2CAP_CON_CLOSED;
119 con->encryption = 0;
134 con->con_handle = fake_con_handle ++;
138 bcopy(bdaddr, &con->remote, sizeof(con->remote));
139 con->linktype = type;
140 ng_callout_init(&con->con_timo);
142 con->ident = NG_L2CAP_FIRST_IDENT - 1;
143 TAILQ_INIT(&con->cmd_list);
146 LIST_INSERT_HEAD(&l2cap->con_list, con, next);
148 return (con);
156 ng_l2cap_con_ref(ng_l2cap_con_p con)
158 con->refcnt ++;
160 if (con->flags & NG_L2CAP_CON_AUTO_DISCON_TIMO) {
161 if ((con->state != NG_L2CAP_CON_OPEN) ||
162 (con->flags & NG_L2CAP_CON_OUTGOING) == 0)
165 __func__, NG_NODE_NAME(con->l2cap->node),
166 con->state, con->flags);
168 ng_l2cap_discon_untimeout(con);
177 ng_l2cap_con_unref(ng_l2cap_con_p con)
179 con->refcnt --;
181 if (con->refcnt < 0)
183 "%s: %s - con->refcnt < 0\n", __func__, NG_NODE_NAME(con->l2cap->node));
194 if ((con->refcnt == 0) &&
195 (con->state == NG_L2CAP_CON_OPEN) &&
196 (con->flags & NG_L2CAP_CON_OUTGOING) &&
197 (con->l2cap->discon_timo > 0) &&
198 ((con->flags & NG_L2CAP_CON_DYING) == 0))
199 ng_l2cap_discon_timeout(con);
208 ng_l2cap_discon_timeout(ng_l2cap_con_p con)
210 if (con->flags & (NG_L2CAP_CON_LP_TIMO|NG_L2CAP_CON_AUTO_DISCON_TIMO))
213 __func__, NG_NODE_NAME(con->l2cap->node),
214 con->state, con->flags);
216 con->flags |= NG_L2CAP_CON_AUTO_DISCON_TIMO;
217 ng_callout(&con->con_timo, con->l2cap->node, NULL,
218 con->l2cap->discon_timo * hz,
220 con->con_handle);
230 ng_l2cap_discon_untimeout(ng_l2cap_con_p con)
232 if (!(con->flags & NG_L2CAP_CON_AUTO_DISCON_TIMO))
235 __func__, NG_NODE_NAME(con->l2cap->node),
236 con->state, con->flags);
238 if (ng_uncallout(&con->con_timo, con->l2cap->node) == 0)
241 con->flags &= ~NG_L2CAP_CON_AUTO_DISCON_TIMO;
251 ng_l2cap_free_con(ng_l2cap_con_p con)
255 con->state = NG_L2CAP_CON_CLOSED;
257 while (con->tx_pkt != NULL) {
258 struct mbuf *m = con->tx_pkt->m_nextpkt;
260 m_freem(con->tx_pkt);
261 con->tx_pkt = m;
264 NG_FREE_M(con->rx_pkt);
266 for (f = LIST_FIRST(&con->l2cap->chan_list); f != NULL; ) {
269 if (f->con == con)
275 while (!TAILQ_EMPTY(&con->cmd_list)) {
276 ng_l2cap_cmd_p cmd = TAILQ_FIRST(&con->cmd_list);
284 if (con->flags & (NG_L2CAP_CON_AUTO_DISCON_TIMO|NG_L2CAP_CON_LP_TIMO))
287 __func__, NG_NODE_NAME(con->l2cap->node),
288 con->state, con->flags);
290 LIST_REMOVE(con, next);
292 bzero(con, sizeof(*con));
293 free(con, M_NETGRAPH_L2CAP);
303 ng_l2cap_con_p con = NULL;
305 LIST_FOREACH(con, &l2cap->con_list, next)
306 if ((bcmp(bdaddr, &con->remote, sizeof(con->remote)) == 0)&&
307 (con->linktype == type))
310 return (con);
320 ng_l2cap_con_p con = NULL;
322 LIST_FOREACH(con, &l2cap->con_list, next)
323 if (con->con_handle == con_handle)
326 return (con);
330 * Allocate new L2CAP channel descriptor on "con" connection with "psm".
335 ng_l2cap_new_chan(ng_l2cap_p l2cap, ng_l2cap_con_p con, u_int16_t psm, int idtype)
349 (con->linktype!= NG_HCI_LINK_ACL));
356 ch->con = con;
371 ng_l2cap_con_ref(con);
393 (ch->con->linktype == NG_HCI_LINK_ACL ))
396 (ch->con->linktype != NG_HCI_LINK_ACL ))
412 (ch->con->con_handle == con_handle))
427 f = TAILQ_FIRST(&ch->con->cmd_list);
444 ng_l2cap_con_unref(ch->con);
455 ng_l2cap_new_cmd(ng_l2cap_con_p con, ng_l2cap_chan_p ch, u_int8_t ident,
460 KASSERT((ch == NULL || ch->con == con),
462 __func__, NG_NODE_NAME(con->l2cap->node)));
469 cmd->con = con;
484 ng_l2cap_cmd_by_ident(ng_l2cap_con_p con, u_int8_t ident)
488 TAILQ_FOREACH(cmd, &con->cmd_list, next) {
490 KASSERT((cmd->con == con),
492 __func__, NG_NODE_NAME(con->l2cap->node)));
507 ng_l2cap_lp_timeout(ng_l2cap_con_p con)
509 if (con->flags & (NG_L2CAP_CON_LP_TIMO|NG_L2CAP_CON_AUTO_DISCON_TIMO))
512 __func__, NG_NODE_NAME(con->l2cap->node),
513 con->state, con->flags);
515 con->flags |= NG_L2CAP_CON_LP_TIMO;
516 ng_callout(&con->con_timo, con->l2cap->node, NULL,
519 con->con_handle);
529 ng_l2cap_lp_untimeout(ng_l2cap_con_p con)
531 if (!(con->flags & NG_L2CAP_CON_LP_TIMO))
534 __func__, NG_NODE_NAME(con->l2cap->node),
535 con->state, con->flags);
537 if (ng_uncallout(&con->con_timo, con->l2cap->node) == 0)
540 con->flags &= ~NG_L2CAP_CON_LP_TIMO;
558 __func__, NG_NODE_NAME(cmd->con->l2cap->node),
561 arg = ((cmd->ident << 16) | cmd->con->con_handle);
563 ng_callout(&cmd->timo, cmd->con->l2cap->node, NULL, timo,
579 __func__, NG_NODE_NAME(cmd->con->l2cap->node),
582 if (ng_uncallout(&cmd->timo, cmd->con->l2cap->node) == 0)
677 ng_l2cap_get_ident(ng_l2cap_con_p con)
679 u_int8_t ident = con->ident + 1;
684 while (ident != con->ident) {
685 if (ng_l2cap_cmd_by_ident(con, ident) == NULL) {
686 con->ident = ident;