aboutsummaryrefslogtreecommitdiff
path: root/pcap.h
diff options
context:
space:
mode:
authorguy <guy>2001-10-08 01:06:20 +0000
committerguy <guy>2001-10-08 01:06:20 +0000
commit9c0a593a2e6544dd6772186ed07a002017ffcdf6 (patch)
treec4d6b4144a114884a025bcbc6445202df217e572 /pcap.h
parent2de302a36243c0a11327a165dfbecc4860b88b13 (diff)
From Scott Gifford:
Add a new "pcap_findalldevs()" routine to get a list of all interfaces that can be opened with "pcap_open_live()", and a "pcap_freealldevs()" routine to free the list. Make "pcap_lookupdev()" use it, which also arranges that it will not return a device that cannot be opened by "pcap_open_live()". Allow the "any" device to be opened, on Linux, with "promisc" non-zero; ignore the request for promiscuity, and return a warning message indicating that promiscuous mode isn't supported on the "any" device. Document "pcap_findalldevs()" and "pcap_lookupdev()", and clean up some items in the libpcap man page.
Diffstat (limited to 'pcap.h')
-rw-r--r--pcap.h30
1 files changed, 29 insertions, 1 deletions
diff --git a/pcap.h b/pcap.h
index 7d62728f..88ccdcfd 100644
--- a/pcap.h
+++ b/pcap.h
@@ -1,3 +1,4 @@
+/* -*- Mode: c; tab-width: 8; indent-tabs-mode: 1; c-basic-offset: 8; -*- */
/*
* Copyright (c) 1993, 1994, 1995, 1996, 1997
* The Regents of the University of California. All rights reserved.
@@ -30,7 +31,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#) $Header: /tcpdump/master/libpcap/pcap.h,v 1.31 2000-10-28 00:01:31 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/libpcap/pcap.h,v 1.32 2001-10-08 01:06:22 guy Exp $ (LBL)
*/
#ifndef lib_pcap_h
@@ -63,6 +64,8 @@ typedef u_int bpf_u_int32;
typedef struct pcap pcap_t;
typedef struct pcap_dumper pcap_dumper_t;
+typedef struct pcap_if pcap_if_t;
+typedef struct pcap_addr pcap_addr_t;
/*
* The first record in the file contains saved values for some
@@ -128,6 +131,28 @@ struct pcap_stat {
u_int ps_ifdrop; /* drops by interface XXX not yet supported */
};
+/*
+ * Item in a list of interfaces.
+ */
+struct pcap_if {
+ struct pcap_if *next;
+ char *name; /* name to hand to "pcap_open_live()" */
+ char *description; /* textual description of interface, or NULL */
+ struct pcap_addr *addresses;
+ u_int is_loopback; /* non-0 if interface is loopback */
+};
+
+/*
+ * Representation of an interface address.
+ */
+struct pcap_addr {
+ struct pcap_addr *next;
+ struct sockaddr *addr; /* address */
+ struct sockaddr *netmask; /* netmask for that address */
+ struct sockaddr *broadaddr; /* broadcast address for that address */
+ struct sockaddr *dstaddr; /* P2P destination address for that address */
+};
+
typedef void (*pcap_handler)(u_char *, const struct pcap_pkthdr *,
const u_char *);
@@ -165,6 +190,9 @@ pcap_dumper_t *pcap_dump_open(pcap_t *, const char *);
void pcap_dump_close(pcap_dumper_t *);
void pcap_dump(u_char *, const struct pcap_pkthdr *, const u_char *);
+int pcap_findalldevs(pcap_if_t **, char *);
+void pcap_freealldevs(pcap_if_t *);
+
/* XXX this guy lives in the bpf tree */
u_int bpf_filter(struct bpf_insn *, u_char *, u_int, u_int);
int bpf_validate(struct bpf_insn *f, int len);