OK, we'll be putting out 0.9.2 soon, so add the API changes back in
again.
This commit is contained in:
parent
5e92dec088
commit
75b14d240d
16
pcap-bpf.c
16
pcap-bpf.c
|
@ -20,7 +20,7 @@
|
||||||
*/
|
*/
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] _U_ =
|
static const char rcsid[] _U_ =
|
||||||
"@(#) $Header: /tcpdump/master/libpcap/pcap-bpf.c,v 1.92 2005-07-05 22:31:57 guy Exp $ (LBL)";
|
"@(#) $Header: /tcpdump/master/libpcap/pcap-bpf.c,v 1.93 2005-07-07 01:57:00 guy Exp $ (LBL)";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
|
@ -105,7 +105,7 @@ static int odmlockid = 0;
|
||||||
#include "gencode.h" /* for "no_optimize" */
|
#include "gencode.h" /* for "no_optimize" */
|
||||||
|
|
||||||
static int pcap_setfilter_bpf(pcap_t *p, struct bpf_program *fp);
|
static int pcap_setfilter_bpf(pcap_t *p, struct bpf_program *fp);
|
||||||
static int pcap_setdirection_bpf(pcap_t *, direction_t);
|
static int pcap_setdirection_bpf(pcap_t *, pcap_direction_t);
|
||||||
static int pcap_set_datalink_bpf(pcap_t *p, int dlt);
|
static int pcap_set_datalink_bpf(pcap_t *p, int dlt);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -1095,26 +1095,26 @@ pcap_setfilter_bpf(pcap_t *p, struct bpf_program *fp)
|
||||||
* single device? IN, OUT or both?
|
* single device? IN, OUT or both?
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
pcap_setdirection_bpf(pcap_t *p, direction_t d)
|
pcap_setdirection_bpf(pcap_t *p, pcap_direction_t d)
|
||||||
{
|
{
|
||||||
#ifdef BIOCSSEESENT
|
#ifdef BIOCSSEESENT
|
||||||
u_int seesent;
|
u_int seesent;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We don't support D_OUT.
|
* We don't support PCAP_D_OUT.
|
||||||
*/
|
*/
|
||||||
if (d == D_OUT) {
|
if (d == PCAP_D_OUT) {
|
||||||
snprintf(p->errbuf, sizeof(p->errbuf),
|
snprintf(p->errbuf, sizeof(p->errbuf),
|
||||||
"Setting direction to D_OUT is not supported on BPF");
|
"Setting direction to PCAP_D_OUT is not supported on BPF");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#ifdef BIOCSSEESENT
|
#ifdef BIOCSSEESENT
|
||||||
seesent = (d == D_INOUT);
|
seesent = (d == PCAP_D_INOUT);
|
||||||
if (ioctl(p->fd, BIOCSSEESENT, &seesent) == -1) {
|
if (ioctl(p->fd, BIOCSSEESENT, &seesent) == -1) {
|
||||||
(void) snprintf(p->errbuf, sizeof(p->errbuf),
|
(void) snprintf(p->errbuf, sizeof(p->errbuf),
|
||||||
"Cannot set direction to %s: %s",
|
"Cannot set direction to %s: %s",
|
||||||
(d == D_INOUT) ? "D_INOUT" : "D_IN",
|
(d == PCAP_D_INOUT) ? "PCAP_D_INOUT" : "PCAP_D_IN",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#) $Header: /tcpdump/master/libpcap/pcap-int.h,v 1.73 2005-07-05 22:31:57 guy Exp $ (LBL)
|
* @(#) $Header: /tcpdump/master/libpcap/pcap-int.h,v 1.74 2005-07-07 01:57:01 guy Exp $ (LBL)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef pcap_int_h
|
#ifndef pcap_int_h
|
||||||
|
@ -151,7 +151,7 @@ struct pcap {
|
||||||
u_char *pkt;
|
u_char *pkt;
|
||||||
|
|
||||||
/* We're accepting only packets in this direction/these directions. */
|
/* We're accepting only packets in this direction/these directions. */
|
||||||
direction_t direction;
|
pcap_direction_t direction;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Methods.
|
* Methods.
|
||||||
|
@ -159,7 +159,7 @@ struct pcap {
|
||||||
int (*read_op)(pcap_t *, int cnt, pcap_handler, u_char *);
|
int (*read_op)(pcap_t *, int cnt, pcap_handler, u_char *);
|
||||||
int (*inject_op)(pcap_t *, const void *, size_t);
|
int (*inject_op)(pcap_t *, const void *, size_t);
|
||||||
int (*setfilter_op)(pcap_t *, struct bpf_program *);
|
int (*setfilter_op)(pcap_t *, struct bpf_program *);
|
||||||
int (*setdirection_op)(pcap_t *, direction_t);
|
int (*setdirection_op)(pcap_t *, pcap_direction_t);
|
||||||
int (*set_datalink_op)(pcap_t *, int);
|
int (*set_datalink_op)(pcap_t *, int);
|
||||||
int (*getnonblock_op)(pcap_t *, char *);
|
int (*getnonblock_op)(pcap_t *, char *);
|
||||||
int (*setnonblock_op)(pcap_t *, int, char *);
|
int (*setnonblock_op)(pcap_t *, int, char *);
|
||||||
|
|
10
pcap-linux.c
10
pcap-linux.c
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] _U_ =
|
static const char rcsid[] _U_ =
|
||||||
"@(#) $Header: /tcpdump/master/libpcap/pcap-linux.c,v 1.114 2005-07-05 22:31:57 guy Exp $ (LBL)";
|
"@(#) $Header: /tcpdump/master/libpcap/pcap-linux.c,v 1.115 2005-07-07 01:57:01 guy Exp $ (LBL)";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -195,7 +195,7 @@ static int pcap_read_packet(pcap_t *, pcap_handler, u_char *);
|
||||||
static int pcap_inject_linux(pcap_t *, const void *, size_t);
|
static int pcap_inject_linux(pcap_t *, const void *, size_t);
|
||||||
static int pcap_stats_linux(pcap_t *, struct pcap_stat *);
|
static int pcap_stats_linux(pcap_t *, struct pcap_stat *);
|
||||||
static int pcap_setfilter_linux(pcap_t *, struct bpf_program *);
|
static int pcap_setfilter_linux(pcap_t *, struct bpf_program *);
|
||||||
static int pcap_setdirection_linux(pcap_t *, direction_t);
|
static int pcap_setdirection_linux(pcap_t *, pcap_direction_t);
|
||||||
static void pcap_close_linux(pcap_t *);
|
static void pcap_close_linux(pcap_t *);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -536,14 +536,14 @@ pcap_read_packet(pcap_t *handle, pcap_handler callback, u_char *userdata)
|
||||||
/*
|
/*
|
||||||
* If the user only wants incoming packets, reject it.
|
* If the user only wants incoming packets, reject it.
|
||||||
*/
|
*/
|
||||||
if (handle->direction == D_IN)
|
if (handle->direction == PCAP_D_IN)
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* Incoming packet.
|
* Incoming packet.
|
||||||
* If the user only wants outgoing packets, reject it.
|
* If the user only wants outgoing packets, reject it.
|
||||||
*/
|
*/
|
||||||
if (handle->direction == D_OUT)
|
if (handle->direction == PCAP_D_OUT)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1014,7 +1014,7 @@ pcap_setfilter_linux(pcap_t *handle, struct bpf_program *filter)
|
||||||
* single device? IN, OUT or both?
|
* single device? IN, OUT or both?
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
pcap_setdirection_linux(pcap_t *handle, direction_t d)
|
pcap_setdirection_linux(pcap_t *handle, pcap_direction_t d)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_PF_PACKET_SOCKETS
|
#ifdef HAVE_PF_PACKET_SOCKETS
|
||||||
if (!handle->md.sock_packet) {
|
if (!handle->md.sock_packet) {
|
||||||
|
|
22
pcap.3
22
pcap.3
|
@ -1,4 +1,4 @@
|
||||||
.\" @(#) $Header: /tcpdump/master/libpcap/Attic/pcap.3,v 1.70 2005-07-05 22:31:57 guy Exp $
|
.\" @(#) $Header: /tcpdump/master/libpcap/Attic/pcap.3,v 1.71 2005-07-07 01:57:01 guy Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 1994, 1996, 1997
|
.\" Copyright (c) 1994, 1996, 1997
|
||||||
.\" The Regents of the University of California. All rights reserved.
|
.\" The Regents of the University of California. All rights reserved.
|
||||||
|
@ -80,7 +80,7 @@ int pcap_compile(pcap_t *p, struct bpf_program *fp,
|
||||||
char *str, int optimize, bpf_u_int32 netmask)
|
char *str, int optimize, bpf_u_int32 netmask)
|
||||||
int pcap_setfilter(pcap_t *p, struct bpf_program *fp)
|
int pcap_setfilter(pcap_t *p, struct bpf_program *fp)
|
||||||
void pcap_freecode(struct bpf_program *)
|
void pcap_freecode(struct bpf_program *)
|
||||||
int pcap_setdirection(pcap_t *p, direction_t d)
|
int pcap_setdirection(pcap_t *p, pcap_direction_t d)
|
||||||
.ft
|
.ft
|
||||||
.LP
|
.LP
|
||||||
.ft B
|
.ft B
|
||||||
|
@ -781,23 +781,23 @@ has been made the filter program for a pcap structure by a call to
|
||||||
.PP
|
.PP
|
||||||
.B pcap_setdirection()
|
.B pcap_setdirection()
|
||||||
is used to specify a direction that packets will be captured.
|
is used to specify a direction that packets will be captured.
|
||||||
.I direction_t
|
.I pcap_direction_t
|
||||||
is one of the constants
|
is one of the constants
|
||||||
.BR D_IN ,
|
.BR PCAP_D_IN ,
|
||||||
.B D_OUT
|
.B PCAP_D_OUT
|
||||||
or
|
or
|
||||||
.BR D_INOUT .
|
.BR PCAP_D_INOUT .
|
||||||
.B D_IN
|
.B PCAP_D_IN
|
||||||
will only capture packets received by the device,
|
will only capture packets received by the device,
|
||||||
.B D_OUT
|
.B PCAP_D_OUT
|
||||||
will only capture packets sent by the device and
|
will only capture packets sent by the device and
|
||||||
.B D_INOUT
|
.B PCAP_D_INOUT
|
||||||
will capture packets received by or sent by the device.
|
will capture packets received by or sent by the device.
|
||||||
.B D_INOUT
|
.B PCAP_D_INOUT
|
||||||
is the default setting if this function is not called. This isn't
|
is the default setting if this function is not called. This isn't
|
||||||
necessarily supported on all platforms; some platforms might return an
|
necessarily supported on all platforms; some platforms might return an
|
||||||
error, and some other platforms might not support
|
error, and some other platforms might not support
|
||||||
.BR D_OUT .
|
.BR PCAP_D_OUT .
|
||||||
This operation is not supported if a ``savefile'' is being read.
|
This operation is not supported if a ``savefile'' is being read.
|
||||||
.B \-1
|
.B \-1
|
||||||
is returned on failure,
|
is returned on failure,
|
||||||
|
|
4
pcap.c
4
pcap.c
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] _U_ =
|
static const char rcsid[] _U_ =
|
||||||
"@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.93 2005-07-05 22:31:58 guy Exp $ (LBL)";
|
"@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.94 2005-07-07 01:57:02 guy Exp $ (LBL)";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
|
@ -696,7 +696,7 @@ pcap_setfilter(pcap_t *p, struct bpf_program *fp)
|
||||||
* might not be supported.
|
* might not be supported.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
pcap_setdirection(pcap_t *p, direction_t d)
|
pcap_setdirection(pcap_t *p, pcap_direction_t d)
|
||||||
{
|
{
|
||||||
if (p->setdirection_op == NULL) {
|
if (p->setdirection_op == NULL) {
|
||||||
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
|
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
|
||||||
|
|
12
pcap.h
12
pcap.h
|
@ -31,7 +31,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#) $Header: /tcpdump/master/libpcap/pcap.h,v 1.56 2005-07-05 22:31:58 guy Exp $ (LBL)
|
* @(#) $Header: /tcpdump/master/libpcap/pcap.h,v 1.57 2005-07-07 01:57:03 guy Exp $ (LBL)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lib_pcap_h
|
#ifndef lib_pcap_h
|
||||||
|
@ -121,10 +121,10 @@ struct pcap_file_header {
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
D_INOUT = 0,
|
PCAP_D_INOUT = 0,
|
||||||
D_IN,
|
PCAP_D_IN,
|
||||||
D_OUT
|
PCAP_D_OUT
|
||||||
} direction_t;
|
} pcap_direction_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Each packet in the dump file is prepended with this generic header.
|
* Each packet in the dump file is prepended with this generic header.
|
||||||
|
@ -224,7 +224,7 @@ int pcap_next_ex(pcap_t *, struct pcap_pkthdr **, const u_char **);
|
||||||
void pcap_breakloop(pcap_t *);
|
void pcap_breakloop(pcap_t *);
|
||||||
int pcap_stats(pcap_t *, struct pcap_stat *);
|
int pcap_stats(pcap_t *, struct pcap_stat *);
|
||||||
int pcap_setfilter(pcap_t *, struct bpf_program *);
|
int pcap_setfilter(pcap_t *, struct bpf_program *);
|
||||||
int pcap_setdirection(pcap_t *, direction_t);
|
int pcap_setdirection(pcap_t *, pcap_direction_t);
|
||||||
int pcap_getnonblock(pcap_t *, char *);
|
int pcap_getnonblock(pcap_t *, char *);
|
||||||
int pcap_setnonblock(pcap_t *, int, char *);
|
int pcap_setnonblock(pcap_t *, int, char *);
|
||||||
void pcap_perror(pcap_t *, char *);
|
void pcap_perror(pcap_t *, char *);
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] _U_ =
|
static const char rcsid[] _U_ =
|
||||||
"@(#) $Header: /tcpdump/master/libpcap/savefile.c,v 1.137 2005-07-05 22:31:58 guy Exp $ (LBL)";
|
"@(#) $Header: /tcpdump/master/libpcap/savefile.c,v 1.138 2005-07-07 01:57:03 guy Exp $ (LBL)";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
|
@ -722,7 +722,7 @@ sf_inject(pcap_t *p, const void *buf _U_, size_t size _U_)
|
||||||
* single device? IN, OUT or both?
|
* single device? IN, OUT or both?
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
sf_setdirection(pcap_t *p, direction_t d)
|
sf_setdirection(pcap_t *p, pcap_direction_t d)
|
||||||
{
|
{
|
||||||
snprintf(p->errbuf, sizeof(p->errbuf),
|
snprintf(p->errbuf, sizeof(p->errbuf),
|
||||||
"Setting direction is not supported on savefiles");
|
"Setting direction is not supported on savefiles");
|
||||||
|
|
Reference in New Issue