summaryrefslogtreecommitdiffstats
path: root/contrib/libpcap/pcap.3
diff options
context:
space:
mode:
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 275dc4f..23e5b52 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
@@ -17,7 +17,7 @@
.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.\"
-.TH PCAP 3 "18 August 1996"
+.TH PCAP 3 "24 June 1998"
.SH NAME
pcap \- Packet Capture library
.SH SYNOPSIS
@@ -37,9 +37,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
@@ -57,7 +57,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
@@ -98,6 +98,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
@@ -163,7 +167,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
@@ -176,9 +180,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
@@ -188,7 +193,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
@@ -219,12 +226,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
@@ -232,6 +243,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
@@ -261,7 +281,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