Home | History | Annotate | Download | only in libpcap

Lines Matching refs:device

36  *   - The loopback device gives every packet twice; on 2.2[.x] kernels,
205 static int iface_get_id(int fd, const char *device, char *ebuf);
207 static int iface_get_mtu(int fd, const char *device, char *ebuf);
208 static int iface_get_arptype(int fd, const char *device, char *ebuf);
212 static int iface_bind_old(int fd, const char *device, char *ebuf);
227 * Get a handle for a live capture from the given device. You can
228 * pass NULL as device to get all packages (without link level
237 pcap_open_live(const char *device, int snaplen, int promisc, int to_ms,
247 if (strstr(device, "dag")) {
248 return dag_open_live(device, snaplen, promisc, to_ms, ebuf);
253 if (strstr(device, "septel")) {
254 return septel_open_live(device, snaplen, promisc, to_ms, ebuf);
277 if (!device || strcmp(device, "any") == 0) {
278 device = NULL;
279 handle->md.device = strdup("any");
284 "Promiscuous mode not supported on the \"any\" device");
288 handle->md.device = strdup(device);
290 if (handle->md.device == NULL) {
307 if ((err = live_open_new(handle, device, promisc, to_ms, ebuf)) == 1)
311 if (live_open_old(handle, device, promisc, to_ms, ebuf))
321 if (handle->md.device != NULL)
322 free(handle->md.device);
360 * device. Unfortunately, we can't get the MRU
378 mtu = iface_get_mtu(handle->fd, device, ebuf);
477 * If this is a cooked device, leave extra room for a
554 * If this is from the loopback device, reject it;
579 * If this is a cooked device, fill in the fake packet header.
752 * We don't support sending on the "any" device.
755 "Sending packets isn't supported on the \"any\" device",
762 * We don't support sending on the "any" device.
898 * Description string for the "any" device.
900 static const char any_descr[] = "Pseudo-device that captures on all interfaces";
922 * Attach the given BPF code to the packet capture device.
1060 * single device? IN, OUT or both?
1267 * figure out from the device name what type of
1388 live_open_new(pcap_t *handle, const char *device, int promisc,
1401 * Open a socket with protocol family packet. If a device is
1405 sock_fd = device ?
1419 * Get the interface index of the loopback device.
1423 * XXX - can there be more than one device that loops
1442 if (device) {
1446 arptype = iface_get_arptype(sock_fd, device, ebuf);
1457 (strncmp("isdn", device, 4) == 0 ||
1458 strncmp("isdY", device, 4) == 0))) {
1461 * device we explicitly chose to run
1463 * or an ISDN device (whose link-layer
1514 handle->md.ifindex = iface_get_id(sock_fd, device, ebuf);
1532 * We're not bound to a device.
1534 * the "any" device?
1562 if (device && promisc) {
1605 * Return the index of the given device name. Fill ebuf and return
1609 iface_get_id(int fd, const char *device, char *ebuf)
1614 strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
1626 * Bind the socket associated with FD to the given device.
1716 strncpy(ifr.ifr_name, handle->md.device, sizeof(ifr.ifr_name));
1766 if (handle->md.device != NULL)
1767 free(handle->md.device);
1768 handle->md.device = NULL;
1778 live_open_old(pcap_t *handle, const char *device, int promisc,
1800 /* Bind to the given device */
1802 if (!device) {
1803 strncpy(ebuf, "pcap_open_live: The \"any\" device isn't supported on 2.0[.x]-kernel systems",
1807 if (iface_bind_old(handle->fd, device, ebuf) == -1)
1813 arptype = iface_get_arptype(handle->fd, device, ebuf);
1832 strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
1899 * Bind the socket associated with FD to the given device using the
1903 iface_bind_old(int fd, const char *device, char *ebuf)
1910 strncpy(saddr.sa_data, device, sizeof(saddr.sa_data));
1941 iface_get_mtu(int fd, const char *device, char *ebuf)
1945 if (!device)
1949 strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
1964 iface_get_arptype(int fd, const char *device, char *ebuf)
1969 strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));