Lines Matching refs:pcb

356 	struct hci_pcb *pcb;  in hci_attach()  local
373 pcb = kmem_zalloc(sizeof(struct hci_pcb), KM_SLEEP); in hci_attach()
374 pcb->hp_cred = kauth_cred_dup(curlwp->l_cred); in hci_attach()
375 pcb->hp_socket = so; in hci_attach()
381 hci_filter_set(HCI_EVENT_COMMAND_COMPL, &pcb->hp_efilter); in hci_attach()
382 hci_filter_set(HCI_EVENT_COMMAND_STATUS, &pcb->hp_efilter); in hci_attach()
383 hci_filter_set(HCI_EVENT_PKT, &pcb->hp_pfilter); in hci_attach()
385 LIST_INSERT_HEAD(&hci_pcb, pcb, hp_next); in hci_attach()
386 so->so_pcb = pcb; in hci_attach()
394 struct hci_pcb *pcb; in hci_detach() local
396 pcb = (struct hci_pcb *)so->so_pcb; in hci_detach()
397 KASSERT(pcb != NULL); in hci_detach()
402 if (pcb->hp_cred != NULL) in hci_detach()
403 kauth_cred_free(pcb->hp_cred); in hci_detach()
406 LIST_REMOVE(pcb, hp_next); in hci_detach()
407 kmem_free(pcb, sizeof(*pcb)); in hci_detach()
421 struct hci_pcb *pcb = so->so_pcb; in hci_bind() local
425 KASSERT(pcb != NULL); in hci_bind()
434 bdaddr_copy(&pcb->hp_laddr, &sa->bt_bdaddr); in hci_bind()
437 pcb->hp_flags |= HCI_PROMISCUOUS; in hci_bind()
439 pcb->hp_flags &= ~HCI_PROMISCUOUS; in hci_bind()
455 struct hci_pcb *pcb = so->so_pcb; in hci_connect() local
459 KASSERT(pcb != NULL); in hci_connect()
471 bdaddr_copy(&pcb->hp_raddr, &sa->bt_bdaddr); in hci_connect()
487 struct hci_pcb *pcb = so->so_pcb; in hci_disconnect() local
490 KASSERT(pcb != NULL); in hci_disconnect()
492 bdaddr_copy(&pcb->hp_raddr, BDADDR_ANY); in hci_disconnect()
544 struct hci_pcb *pcb = (struct hci_pcb *)so->so_pcb; in hci_peeraddr() local
548 KASSERT(pcb != NULL); in hci_peeraddr()
554 bdaddr_copy(&sa->bt_bdaddr, &pcb->hp_raddr); in hci_peeraddr()
561 struct hci_pcb *pcb = (struct hci_pcb *)so->so_pcb; in hci_sockaddr() local
565 KASSERT(pcb != NULL); in hci_sockaddr()
571 bdaddr_copy(&sa->bt_bdaddr, &pcb->hp_laddr); in hci_sockaddr()
595 struct hci_pcb *pcb = so->so_pcb; in hci_send() local
603 KASSERT(pcb != NULL); in hci_send()
645 unit = hci_unit_lookup((sa ? &sa->bt_bdaddr : &pcb->hp_raddr)); in hci_send()
652 if (pcb->hp_cred != NULL in hci_send()
653 && kauth_authorize_device(pcb->hp_cred, in hci_send()
666 sbappendrecord(&pcb->hp_socket->so_snd, m0); in hci_send()
667 M_SETCTX(m, pcb->hp_socket); /* enable drop callback */ in hci_send()
712 struct hci_pcb *pcb = (struct hci_pcb *)so->so_pcb; in hci_ctloutput() local
717 if (pcb == NULL) in hci_ctloutput()
727 err = sockopt_set(sopt, &pcb->hp_efilter, in hci_ctloutput()
733 err = sockopt_set(sopt, &pcb->hp_pfilter, in hci_ctloutput()
740 (pcb->hp_flags & HCI_DIRECTION ? 1 : 0)); in hci_ctloutput()
753 err = sockopt_get(sopt, &pcb->hp_efilter, in hci_ctloutput()
754 sizeof(pcb->hp_efilter)); in hci_ctloutput()
759 err = sockopt_get(sopt, &pcb->hp_pfilter, in hci_ctloutput()
760 sizeof(pcb->hp_pfilter)); in hci_ctloutput()
770 pcb->hp_flags |= HCI_DIRECTION; in hci_ctloutput()
772 pcb->hp_flags &= ~HCI_DIRECTION; in hci_ctloutput()
798 struct hci_pcb *pcb; in hci_mtap() local
814 LIST_FOREACH(pcb, &hci_pcb, hp_next) { in hci_mtap()
818 if ((pcb->hp_flags & HCI_PROMISCUOUS) == 0 in hci_mtap()
819 && bdaddr_same(&pcb->hp_laddr, &sa.bt_bdaddr) == 0) in hci_mtap()
825 if (hci_filter_test(type, &pcb->hp_pfilter) == 0) in hci_mtap()
837 if (hci_filter_test(event, &pcb->hp_efilter) == 0) in hci_mtap()
865 if (pcb->hp_cred != NULL in hci_mtap()
866 && kauth_authorize_device(pcb->hp_cred, in hci_mtap()
876 if (pcb->hp_flags & HCI_DIRECTION) { in hci_mtap()
885 if (pcb->hp_socket->so_options & SO_TIMESTAMP) { in hci_mtap()
900 if (m0 && sbappendaddr(&pcb->hp_socket->so_rcv, in hci_mtap()
902 sorwakeup(pcb->hp_socket); in hci_mtap()