aboutsummaryrefslogtreecommitdiffstats
path: root/pcap.h
AgeCommit message (Collapse)AuthorFilesLines
2002-12-19NetBSD support for multiple data link types on an interface, from Davidguy1-1/+5
Young <dyoung@ojctech.com>, with some minor changes by Jason R. Thorpe <thorpej@netbsd.org>, and further changes by me to support it on BPF systems lacking BIOCGDLTLIST and other platforms lacking an equivalent feature. Update Jason Thorpe's e-mail address (Zembu is going away, if it hasn't done so already). Add APIs to map DLT names to DLT values and vice versa.
2002-08-02Use <pcap-stdinc.h> only on Windows; on UNIX, selectively include, inguy1-1/+6
each source file, only the headers that file needs, and all the headers it needs in order to compile on various platforms and not to get any avoidable compiler warnings on those platforms (as well as any incomplete structure definitions needed to avoid those warnings). That also means that <pcap.h> doesn't include <pcap-stdinc.h> on UNIX; we don't want it to include <pcap-stdinc.h>, at least on UNIX, as doing so 1) would mean we'd have to install that, so that programs can build with libpcap and 2) would mean that programs including <pcap.h> would drag in a bunch of header files that they don't need. Put a newline at the end of "inet.c" - the Sun C compiler doesn't like it if the last line doesn't end with a newline.
2002-08-01Added support for Win32, based on WinPcap.risso1-3/+25
2002-07-20Make "flags" in a "struct pcap_if" a "bpf_u_int32", as requested byguy1-2/+2
Fulvio Risso.
2001-12-09Add APIs to put a "pcap_t" into or out of non-blocking mode, and to getguy1-1/+3
the current state of non-blocking mode; this allows us to implement, for example, memory-mapped capture devices, where "pcap_read()" uses "select()" or "poll()" to wait for packets to arrive, and hide that implementation detail from applications using this API ("pcap_setnonblock()" would set or clear a non-blocking mode flag in the "pcap_t", and the "select()" or "poll()" would not be done if the "pcap_t" is in non-blocking mode).
2001-10-28Make the "is_loopback" field of a "pcap_if" structure a general "flags"guy1-2/+4
field, and make a PCAP_IF_LOOPBACK flag be the first flag bit in that field, specifying whether the interface is a loopback interface; this allows us to add more flags without changing the layout of the structure.
2001-10-08From Scott Gifford:guy1-1/+29
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.
2000-10-28When attaching a "bpf_program" to a "pcap_t" to use as a userlandguy1-2/+2
filter, always attach a copy, as "pcap-linux.c" does; that way, after a program uses "pcap_setfilter()", it can safely use "pcap_freecode()" to free up the BPF instructions allocated by "pcap_compile()". Also, always free it up when the "pcap_t" is closed. Get rid of the "pcap_t *" argument to "pcap_freecode()", as it's not necessary. Document "pcap_freecode()", for the benefit of programs that might repeatedly compile filter programs and attach them, so that they can free them up after attaching them and avoid leaking memory for them.
2000-10-25The Linux "pcap_setfilter()" makes a copy of the filter it's handed, andguy1-3/+2
installs that copy; when closing a pcap_t on Linux, free that copy.
2000-10-12In addition to telling people not to change the format of the savefileguy1-3/+10
header without getting a new magic number from us, tell them not to change the interpretation of any fields in the header without getting a new magic number from us.
2000-10-12Get rid of the PCAP_ENCAP_ values - if an application uses them, thatguy1-90/+2
application won't build with any other version of libpcap, which means that a lot of applications won't use them. In addition, "pcap_linktype()" needs to return DLT_ values, so that platforms that build libpcap as a shared library won't break binary compatibility if they update to this version of libpcap. Instead, we map from DLT_ values to LINKTYPE_ values when writing savefiles, and map from LINKTYPE_ values to DLT_ values when reading savefiles, so that savefiles don't have platform-dependent DLT_ values in the header as the link type, they have platform-independent LINKTYPE_ values. This means we don't need to make DLT_ATM_RFC1483, DLT_RAW, etc. have platform-independent values starting at 100 - only the values in the savefile header need to be like that.
2000-09-18Add support for NetBSD DLT_PPP_SERIAL (PPP in HDLC-like framing, as perguy1-1/+13
RFC 1662, or Cisco point-to-point with HDLC framing, as per seciont 4.3.1 of RFC 1547; there's always an address and control octet at the beginning of these packets, but they're not necessarily 0xff 0x03), which we map to PCAP_ENCAP_PPP_HDLC.
2000-09-17Introduce a set of PCAP_ENCAP_ codes to specify packet encapsulations.guy1-2/+78
For those PCAP_ENCAP_ codes corresponding to DLT_ codes that are (believed to be) the same in all BSDs, the PCAP_ENCAP_ codes have the same values as the corresponding DLT_ codes. For those PCAP_ENCAP_ codes corresponding to DLT_ codes that were added in libpcap 0.5 as "non-kernel" DLT_ codes, or had their values changed in libpcap 0.5 in order to cope with the fact that those DLT_ codes have different values in different systems, the PCAP_ENCAP_ codes have the same values as the corresponding DLT_ codes. We add some additional PCAP_ENCAP_ codes to handle IEEE 802.11 (which currently has its link-layer information turned into an Ethernet header by at least some of the BSDs, but John Hawkinson at MIT wants to add a DLT_ value for 802.11 and pass up the full link-layer header) and the Classical IP encapsulation for ATM on Linux (which isn't always the same as DLT_ATM_RFC1483, from what I can tell, alas). "pcap-bpf.c" maps DLT_ codes to PCAP_ENCAP_ codes, so as not to supply to libpcap's callers any DLT_ codes other than the ones that have the same values on all platforms; it supplies PCAP_ENCAP_ codes for all others. In libpcap's "bpf/net/bpf.h", we define the DLT_ values that aren't the same on all platforms with the new values starting at 100 (to keep them out of the way of the values various BSDs might assign to them), as we did in 0.5, but do so only if they're not already defined; platforms with <net/bpf.h> headers that come with the kernel (e.g., the BSDs) should define them with the values that they have always had on that platform, *not* with the values we used in 0.5. (Code using this version of libpcap should check for the new PCAP_ENCAP_ codes; those are given the values that the corresponding DLT_ values had in 0.5, so code that checks for them will handle 0.5 libpcap files correctly even if the platform defines DLT_RAW, say, as something other than 101. If that code also checks for DLT_RAW - which means it can't just use a switch statement, as DLT_RAW might be defined as 101 if the platform doesn't itself define DLT_RAW with some other value - then it will also handle old DLT_RAW captures, as long as they were made on the same platform or on another platform that used the same value for DLT_RAW. It can't handle captures from a platform that uses that value for another DLT_ code, but that's always been the case, and isn't easily fixable.) The intent here is to decouple the values that are returned by "pcap_datalink()" and put into the header of tcpdump/libpcap save files from the DLT_ values returned by BIOCGDLT in BSD kernels, allowing the BSDs to assign values to DLT_ codes, in their kernels, as they choose, without creating more incompatibilities between tcpdump/libpcap save files from different platforms.
2000-09-14Add comments telling people not to gratuitously change the capture fileguy1-1/+22
format (file header or per-packet header format, or interpretation of any of the fields in those headers) without getting a new magic number from "tcpdump-workers@tcpdump.org", and to make sure that libpcap can still read files with the existing magic numbers, not just files with the new magic number and record formats. (There have been at least three libpcap changes I know of that have changed the header formats, or the interpretation of fields in those headers, without changing the magic number. I would like not to ever have any other such changes happen ever again.)
2000-07-29Pick up, from the FreeBSD libpcap, changes to surround all declarations withguy1-1/+10
#ifdef __cplusplus extern "C" { #endif ... #ifdef __cplusplus } #endif so that C++ code can include these header files and correctly call the C-language routines they declare.
2000-06-26(pcap_open_dead, bpf_validate, bpf_dump): addassar1-1/+4
1999-12-08 This adds a new function that allows using the bpf compiler withoutmcr1-1/+3
having a pcap open. One could argue that this and the existing compiler should be factored in common routines, but I was trying to make it clear that this wouldn't break the existing code. from Greg Troxel <gdt@ir.bbn.com>
1999-10-07Initial revisionmcr1-0/+137