Lines Matching refs:handle

86 bt_monitor_read(pcap_t *handle, int max_packets _U_, pcap_handler callback, u_char *user)
97 pktd = (u_char *)handle->buffer + BT_CONTROL_SIZE;
103 iv[1].iov_len = handle->snapshot;
109 msg.msg_control = handle->buffer;
113 ret = recvmsg(handle->fd, &msg, 0);
114 if (handle->break_loop)
116 handle->break_loop = 0;
122 pcap_fmt_errmsg_for_errno(handle->errbuf, PCAP_ERRBUF_SIZE,
141 if (handle->fcode.bf_insns == NULL ||
142 bpf_filter(handle->fcode.bf_insns, pktd, pkth.len, pkth.caplen)) {
150 bt_monitor_inject(pcap_t *handle, const void *buf _U_, size_t size _U_)
152 pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
165 bt_monitor_stats(pcap_t *handle _U_, struct pcap_stat *stats)
175 bt_monitor_activate(pcap_t* handle)
181 if (handle->opt.rfmon) {
194 if (handle->snapshot <= 0 || handle->snapshot > MAXIMUM_SNAPLEN)
195 handle->snapshot = MAXIMUM_SNAPLEN;
197 handle->bufsize = BT_CONTROL_SIZE + sizeof(pcap_bluetooth_linux_monitor_header) + handle->snapshot;
198 handle->linktype = DLT_BLUETOOTH_LINUX_MONITOR;
200 handle->read_op = bt_monitor_read;
201 handle->inject_op = bt_monitor_inject;
202 handle->setfilter_op = install_bpf_program; /* no kernel filtering */
203 handle->setdirection_op = bt_monitor_setdirection;
204 handle->set_datalink_op = NULL; /* can't change data link type */
205 handle->getnonblock_op = pcap_getnonblock_fd;
206 handle->setnonblock_op = pcap_setnonblock_fd;
207 handle->stats_op = bt_monitor_stats;
209 handle->fd = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
210 if (handle->fd < 0) {
211 pcap_fmt_errmsg_for_errno(handle->errbuf, PCAP_ERRBUF_SIZE,
216 handle->buffer = malloc(handle->bufsize);
217 if (!handle->buffer) {
218 pcap_fmt_errmsg_for_errno(handle->errbuf, PCAP_ERRBUF_SIZE,
228 if (bind(handle->fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
229 pcap_fmt_errmsg_for_errno(handle->errbuf, PCAP_ERRBUF_SIZE,
235 if (setsockopt(handle->fd, SOL_SOCKET, SO_TIMESTAMP, &opt, sizeof(opt)) < 0) {
236 pcap_fmt_errmsg_for_errno(handle->errbuf, PCAP_ERRBUF_SIZE,
241 handle->selectable_fd = handle->fd;
246 pcap_cleanup_live_common(handle);