Lines Matching defs:handle

99 bt_monitor_read(pcap_t *handle, int max_packets _U_, pcap_handler callback, u_char *user)
110 pktd = (u_char *)handle->buffer + BT_CONTROL_SIZE;
116 iv[1].iov_len = handle->snapshot;
122 msg.msg_control = handle->buffer;
126 ret = recvmsg(handle->fd, &msg, 0);
127 if (handle->break_loop)
129 handle->break_loop = 0;
139 pcap_fmt_errmsg_for_errno(handle->errbuf, PCAP_ERRBUF_SIZE,
158 if (handle->fcode.bf_insns == NULL ||
159 pcap_filter(handle->fcode.bf_insns, pktd, pkth.len, pkth.caplen)) {
167 bt_monitor_inject(pcap_t *handle, const void *buf _U_, int size _U_)
169 snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
175 bt_monitor_stats(pcap_t *handle _U_, struct pcap_stat *stats)
185 bt_monitor_activate(pcap_t* handle)
191 if (handle->opt.rfmon) {
204 if (handle->snapshot <= 0 || handle->snapshot > MAXIMUM_SNAPLEN)
205 handle->snapshot = MAXIMUM_SNAPLEN;
207 handle->bufsize = BT_CONTROL_SIZE + sizeof(pcap_bluetooth_linux_monitor_header) + handle->snapshot;
208 handle->linktype = DLT_BLUETOOTH_LINUX_MONITOR;
210 handle->read_op = bt_monitor_read;
211 handle->inject_op = bt_monitor_inject;
212 handle->setfilter_op = install_bpf_program; /* no kernel filtering */
213 handle->setdirection_op = NULL; /* Not implemented */
214 handle->set_datalink_op = NULL; /* can't change data link type */
215 handle->getnonblock_op = pcap_getnonblock_fd;
216 handle->setnonblock_op = pcap_setnonblock_fd;
217 handle->stats_op = bt_monitor_stats;
219 handle->fd = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
220 if (handle->fd < 0) {
221 pcap_fmt_errmsg_for_errno(handle->errbuf, PCAP_ERRBUF_SIZE,
226 handle->buffer = malloc(handle->bufsize);
227 if (!handle->buffer) {
228 pcap_fmt_errmsg_for_errno(handle->errbuf, PCAP_ERRBUF_SIZE,
238 if (bind(handle->fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
239 pcap_fmt_errmsg_for_errno(handle->errbuf, PCAP_ERRBUF_SIZE,
245 if (setsockopt(handle->fd, SOL_SOCKET, SO_TIMESTAMP, &opt, sizeof(opt)) < 0) {
246 pcap_fmt_errmsg_for_errno(handle->errbuf, PCAP_ERRBUF_SIZE,
251 handle->selectable_fd = handle->fd;
256 pcap_cleanup_live_common(handle);