WinPcap 4.1.3
incs/pcap.h
Go to the documentation of this file.
1/* -*- Mode: c; tab-width: 8; indent-tabs-mode: 1; c-basic-offset: 8; -*- */
2/*
3 * Copyright (c) 1993, 1994, 1995, 1996, 1997
4 * The Regents of the University of California. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software
15 * must display the following acknowledgement:
16 * This product includes software developed by the Computer Systems
17 * Engineering Group at Lawrence Berkeley Laboratory.
18 * 4. Neither the name of the University nor of the Laboratory may be used
19 * to endorse or promote products derived from this software without
20 * specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#) $Header: /usr/cvsroot_private/winpcap/dox/libpcap/incs/pcap.h,v 1.5 2005/11/30 21:48:23 gianlucav Exp $ (LBL)
35 */
36
37
43
44#ifndef lib_pcap_h
45#define lib_pcap_h
46
47#include <pcap-stdinc.h>
48#include <net/bpf.h>
49
50#include <stdio.h>
51
52#ifdef __cplusplus
53extern "C" {
54#endif
55
56#define PCAP_VERSION_MAJOR 2
57#define PCAP_VERSION_MINOR 4
58
59#define PCAP_ERRBUF_SIZE 256
60
65#if BPF_RELEASE - 0 < 199406
66typedef int bpf_int32;
67typedef u_int bpf_u_int32;
68#endif
69
70typedef struct pcap pcap_t;
71typedef struct pcap_dumper pcap_dumper_t;
72typedef struct pcap_if pcap_if_t;
73typedef struct pcap_addr pcap_addr_t;
74
119
131
136struct pcap_stat {
137 u_int ps_recv;
138 u_int ps_drop;
139 u_int ps_ifdrop;
140#ifdef WIN32
141 u_int bs_capt;
142#endif /* WIN32 */
143};
144
148struct pcap_if {
149 struct pcap_if *next;
150 char *name;
153 u_int flags;
154};
155
156#define PCAP_IF_LOOPBACK 0x00000001
157
161struct pcap_addr {
162 struct pcap_addr *next;
163 struct sockaddr *addr;
164 struct sockaddr *netmask;
165 struct sockaddr *broadaddr;
166 struct sockaddr *dstaddr;
167};
168
169#if defined(WIN32)
170
171
172#define MODE_CAPT 0
173#define MODE_STAT 1
174
175#endif /* WIN32 */
176
177#ifdef __cplusplus
178}
179#endif
180
181#endif
182
u_int bpf_u_int32
32-bit unsigned integer
Definition incs/pcap.h:67
struct pcap_if pcap_if_t
Item in a list of interfaces, see pcap_if.
Definition incs/pcap.h:72
struct pcap pcap_t
Descriptor of an open capture instance. This structure is opaque to the user, that handles its conten...
Definition incs/pcap.h:70
int bpf_int32
32-bit integer
Definition incs/pcap.h:66
struct pcap_dumper pcap_dumper_t
libpcap savefile descriptor.
Definition incs/pcap.h:71
struct pcap_addr pcap_addr_t
Representation of an interface address, see pcap_addr.
Definition incs/pcap.h:73
Representation of an interface address, used by pcap_findalldevs().
Definition incs/pcap.h:161
struct sockaddr * broadaddr
if not NULL, a pointer to a struct sockaddr that contains the broadcast address corre­ sponding to th...
Definition incs/pcap.h:165
struct sockaddr * addr
a pointer to a struct sockaddr containing an address
Definition incs/pcap.h:163
struct sockaddr * dstaddr
if not NULL, a pointer to a struct sockaddr that contains the destination address corre­ sponding to ...
Definition incs/pcap.h:166
struct pcap_addr * next
if not NULL, a pointer to the next element in the list; NULL for the last element of the list
Definition incs/pcap.h:162
struct sockaddr * netmask
if not NULL, a pointer to a struct sockaddr that contains the netmask corresponding to the address po...
Definition incs/pcap.h:164
Header of a libpcap dump file.
Definition incs/pcap.h:110
bpf_u_int32 magic
Definition incs/pcap.h:111
bpf_u_int32 linktype
data link type (LINKTYPE_*)
Definition incs/pcap.h:117
bpf_u_int32 sigfigs
accuracy of timestamps
Definition incs/pcap.h:115
u_short version_major
Libpcap major version.
Definition incs/pcap.h:112
u_short version_minor
Libpcap minor version.
Definition incs/pcap.h:113
bpf_u_int32 snaplen
max length saved portion of each pkt
Definition incs/pcap.h:116
bpf_int32 thiszone
gmt to local correction
Definition incs/pcap.h:114
Item in a list of interfaces, used by pcap_findalldevs().
Definition incs/pcap.h:148
u_int flags
PCAP_IF_ interface flags. Currently the only possible flag is PCAP_IF_LOOPBACK, that is set if the in...
Definition incs/pcap.h:153
struct pcap_addr * addresses
a pointer to the first element of a list of addresses for the interface
Definition incs/pcap.h:152
char * name
a pointer to a string giving a name for the device to pass to pcap_open_live()
Definition incs/pcap.h:150
struct pcap_if * next
if not NULL, a pointer to the next element in the list; NULL for the last element of the list
Definition incs/pcap.h:149
char * description
if not NULL, a pointer to a string giving a human-readable description of the device
Definition incs/pcap.h:151
Header of a packet in the dump file.
Definition incs/pcap.h:126
struct timeval ts
time stamp
Definition incs/pcap.h:127
bpf_u_int32 len
length this packet (off wire)
Definition incs/pcap.h:129
bpf_u_int32 caplen
length of portion present
Definition incs/pcap.h:128
Structure that keeps statistical values on an interface.
Definition incs/pcap.h:136
u_int ps_drop
number of packets dropped by the driver
Definition incs/pcap.h:138
u_int bs_capt
Win32 specific. number of packets captured, i.e number of packets that are accepted by the filter,...
Definition incs/pcap.h:141
u_int ps_recv
number of packets transited on the network
Definition incs/pcap.h:137
u_int ps_ifdrop
drops by interface, not yet supported
Definition incs/pcap.h:139

documentation. Copyright (c) 2002-2005 Politecnico di Torino. Copyright (c) 2005-2010 CACE Technologies. Copyright (c) 2010-2013 Riverbed Technology. All rights reserved.