summaryrefslogtreecommitdiffstats
path: root/contrib/libpcap/pcap.3
diff options
context:
space:
mode:
authorfenner <fenner@FreeBSD.org>1998-09-15 19:31:43 +0000
committerfenner <fenner@FreeBSD.org>1998-09-15 19:31:43 +0000
commiteba95a7c80ca78a1aab3295884a272ed03ae80ab (patch)
tree3aff83cde4c60bfbff0d4a92e35416e45b637477 /contrib/libpcap/pcap.3
parent487207a9c43f463427c6007dee1bfb94d66ec21f (diff)
downloadFreeBSD-src-eba95a7c80ca78a1aab3295884a272ed03ae80ab.zip
FreeBSD-src-eba95a7c80ca78a1aab3295884a272ed03ae80ab.tar.gz
Merge libpcap version 0.4
PR: bin/7877
Diffstat (limited to 'contrib/libpcap/pcap.3')
-rw-r--r--contrib/libpcap/pcap.342
1 files changed, 31 insertions, 11 deletions
diff --git a/contrib/libpcap/pcap.3 b/contrib/libpcap/pcap.3
index fae0c0e..6c1eaea 100644
--- a/contrib/libpcap/pcap.3
+++ b/contrib/libpcap/pcap.3
@@ -1,4 +1,4 @@
-.\" Copyright (c) 1994, 1996
+.\" Copyright (c) 1994, 1996, 1997
.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -19,7 +19,7 @@
.\"
.\" $Id$
.\"
-.TH PCAP 3 "18 August 1996"
+.TH PCAP 3 "24 June 1998"
.SH NAME
pcap \- Packet Capture library
.SH SYNOPSIS
@@ -39,9 +39,9 @@ pcap_dumper_t *pcap_dump_open(pcap_t *p, char *fname)
.ft B
char errbuf[PCAP_ERRBUF_SIZE];
char *pcap_lookupdev(char *errbuf)
-int pcap_lookupnet(char *device, u_long *netp,
+int pcap_lookupnet(char *device, bpf_u_int32 *netp,
.ti +8
-u_long *maskp, char *errbuf)
+bpf_u_int32 *maskp, char *errbuf)
.ft
.LP
.ft B
@@ -59,7 +59,7 @@ u_char *sp)
.ft B
int pcap_compile(pcap_t *p, struct bpf_program *fp,
.ti +8
-char *str, int optimize, u_long netmask)
+char *str, int optimize, bpf_u_int32 netmask)
int pcap_setfilter(pcap_t *p, struct bpf_program *fp)
.ft
.LP
@@ -100,6 +100,10 @@ at packets on the network.
is a string that specifies the network device to open.
.I snaplen
specifies the maximum number of bytes to capture.
+.I promisc
+specifies if the interface is to be put into promiscuous mode.
+(Note that even if this parameter is false, the interface
+could well be in promiscuous mode for some other reason.)
.I to_ms
specifies the read timeout in milliseconds.
.I ebuf
@@ -165,7 +169,7 @@ Both
and
.I maskp
are
-.I u_long
+.I bpf_u_int32
pointers.
A return of -1 indicates an error in which case
.I errbuf
@@ -178,9 +182,10 @@ specifies the maximum number of packets to process before returning. A
.I cnt
of -1 processes all the packets received in one buffer. A
.I cnt
-of 0 processes all packets until an error occurs (or
+of 0 processes all packets until an error occurs,
.B EOF
-is reached).
+is reached, or the read times out (when doing live reads and a non-zero
+read timeout is specified).
.I callback
specifies a routine to be called with three arguments:
a
@@ -190,7 +195,9 @@ pointer which is passed in from
a pointer to the
.I pcap_pkthdr
struct (which precede the actual network headers and data),
-and a length. The number of packets read is returned.
+and a
+.I u_char
+pointer to the packet data. The number of packets read is returned.
Zero is returned when
.B EOF
is reached in a ``savefile.'' A return of -1 indicates
@@ -221,12 +228,16 @@ controls whether optimization on the resulting code is performed.
specifies the netmask of the local net.
.PP
.B pcap_setfilter()
-is used to specify the a filter program.
+is used to specify a filter program.
.I fp
is a pointer to an array of
.I bpf_program
struct, usually the result of a call to
.BR pcap_compile() .
+.B \-1
+is returned on failure;
+.B 0
+is returned on success.
.PP
.B pcap_loop()
is similar to
@@ -234,6 +245,15 @@ is similar to
except it keeps reading packets until
.I cnt
packets are processed or an error occurs.
+It does
+.B not
+return when live read timeouts occur.
+Rather, specifying a non-zero read timeout to
+.B pcap_open_live()
+and then calling
+.B pcap_dispatch()
+allows the reception and processing of any packets that arrive when the
+timeout occurs.
A negative
.I cnt
causes
@@ -263,7 +283,7 @@ returns the major number of the version of the pcap used to write the
savefile.
.PP
.B pcap_minor_version()
-returns the major number of the version of the pcap used to write the
+returns the minor number of the version of the pcap used to write the
savefile.
.PP
.B pcap_file()
OpenPOWER on IntegriCloud