Lines Matching full:handle
93 bt_monitor_read(pcap_t *handle, int max_packets _U_, pcap_handler callback, u_char *user)
104 pktd = (u_char *)handle->buffer + BT_CONTROL_SIZE;
110 iv[1].iov_len = handle->snapshot;
116 msg.msg_control = handle->buffer;
120 if (handle->break_loop)
122 handle->break_loop = 0;
125 ret = recvmsg(handle->fd, &msg, 0);
133 pcapint_fmt_errmsg_for_errno(handle->errbuf, PCAP_ERRBUF_SIZE,
155 if (handle->fcode.bf_insns == NULL ||
156 pcapint_filter(handle->fcode.bf_insns, pktd, pkth.len, pkth.caplen)) {
164 bt_monitor_inject(pcap_t *handle, const void *buf _U_, int size _U_)
166 snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
172 bt_monitor_stats(pcap_t *handle _U_, struct pcap_stat *stats)
182 bt_monitor_activate(pcap_t* handle)
188 if (handle->opt.rfmon) {
201 if (handle->snapshot <= 0 || handle->snapshot > MAXIMUM_SNAPLEN)
202 handle->snapshot = MAXIMUM_SNAPLEN;
204 handle->bufsize = BT_CONTROL_SIZE + sizeof(pcap_bluetooth_linux_monitor_header) + handle->snapshot;
205 handle->linktype = DLT_BLUETOOTH_LINUX_MONITOR;
207 handle->read_op = bt_monitor_read;
208 handle->inject_op = bt_monitor_inject;
209 handle->setfilter_op = pcapint_install_bpf_program; /* no kernel filtering */
210 handle->setdirection_op = NULL; /* Not implemented */
211 handle->set_datalink_op = NULL; /* can't change data link type */
212 handle->getnonblock_op = pcapint_getnonblock_fd;
213 handle->setnonblock_op = pcapint_setnonblock_fd;
214 handle->stats_op = bt_monitor_stats;
216 handle->fd = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
217 if (handle->fd < 0) {
218 pcapint_fmt_errmsg_for_errno(handle->errbuf, PCAP_ERRBUF_SIZE,
223 handle->buffer = malloc(handle->bufsize);
224 if (!handle->buffer) {
225 pcapint_fmt_errmsg_for_errno(handle->errbuf, PCAP_ERRBUF_SIZE,
235 if (bind(handle->fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
236 pcapint_fmt_errmsg_for_errno(handle->errbuf, PCAP_ERRBUF_SIZE,
242 if (setsockopt(handle->fd, SOL_SOCKET, SO_TIMESTAMP, &opt, sizeof(opt)) < 0) {
243 pcapint_fmt_errmsg_for_errno(handle->errbuf, PCAP_ERRBUF_SIZE,
248 handle->selectable_fd = handle->fd;
253 pcapint_cleanup_live_common(handle);