]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/libpcap/pcap_set_immediate_mode.3pcap.in
Merge llvm-project release/16.x llvmorg-16.0.6-0-g7cbf1a259152
[FreeBSD/FreeBSD.git] / contrib / libpcap / pcap_set_immediate_mode.3pcap.in
1 .\"
2 .\" Copyright (c) 1994, 1996, 1997
3 .\"     The Regents of the University of California.  All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that: (1) source code distributions
7 .\" retain the above copyright notice and this paragraph in its entirety, (2)
8 .\" distributions including binary code include the above copyright notice and
9 .\" this paragraph in its entirety in the documentation or other materials
10 .\" provided with the distribution, and (3) all advertising materials mentioning
11 .\" features or use of this software display the following acknowledgement:
12 .\" ``This product includes software developed by the University of California,
13 .\" Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
14 .\" the University nor the names of its contributors may be used to endorse
15 .\" or promote products derived from this software without specific prior
16 .\" written permission.
17 .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
18 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
19 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 .\"
21 .TH PCAP_SET_IMMEDIATE_MODE 3PCAP "23 August 2018"
22 .SH NAME
23 pcap_set_immediate_mode \- set immediate mode for a not-yet-activated capture
24 handle
25 .SH SYNOPSIS
26 .nf
27 .ft B
28 #include <pcap/pcap.h>
29 .LP
30 .ft B
31 int pcap_set_immediate_mode(pcap_t *p, int immediate_mode);
32 .ft
33 .fi
34 .SH DESCRIPTION
35 .BR pcap_set_immediate_mode ()
36 sets whether immediate mode should be set on a capture handle when
37 the handle is activated.  In immediate mode, packets are always
38 delivered as soon as they arrive, with no buffering.
39 If
40 .I immediate_mode
41 is non-zero, immediate mode will be set, otherwise it will not be set.
42 .SH RETURN VALUE
43 .BR pcap_set_immediate_mode ()
44 returns
45 .B 0
46 on success or
47 .B PCAP_ERROR_ACTIVATED
48 if called on a capture handle that has been activated.
49 .SH BACKWARD COMPATIBILITY
50 .PP
51 This function became available in libpcap release 1.5.0.  In previous
52 releases, if immediate delivery of packets is required:
53 .IP
54 on FreeBSD, NetBSD, OpenBSD, DragonFly BSD, macOS, and Solaris 11,
55 immediate mode must be turned on with a
56 .B BIOCIMMEDIATE
57 .BR ioctl (2),
58 as documented in
59 .BR bpf (@MAN_DEVICES@),
60 on the descriptor returned by
61 .BR pcap_fileno (3PCAP),
62 after
63 .BR pcap_activate (3PCAP)
64 is called;
65 .IP
66 on Solaris 10 and earlier versions of Solaris, immediate mode must be
67 turned on by using a read timeout of 0 when opening the device (this
68 will not provide immediate delivery of packets on other platforms, so
69 don't assume it's sufficient);
70 .IP
71 on Digital UNIX/Tru64 UNIX, immediate mode must be turned on by doing a
72 .B BIOCMBIC
73 .BR ioctl (),
74 as documented in
75 .BR packetfilter (7),
76 to clear the
77 .B ENBATCH
78 flag on the descriptor returned by
79 .BR pcap_fileno (3PCAP),
80 after
81 .BR pcap_activate (3PCAP)
82 is called;
83 .IP
84 on Windows, immediate mode must be turned on by calling
85 .BR pcap_setmintocopy ()
86 with a size of 0.
87 .PP
88 On Linux, with previous releases of libpcap, capture devices are always
89 in immediate mode; however, in 1.5.0 and later, they are, by default,
90 .B not
91 in immediate mode, so if
92 .BR pcap_set_immediate_mode ()
93 is available, it should be used.
94 .PP
95 On other platforms, capture devices are always in immediate mode.
96 .SH SEE ALSO
97 .BR pcap (3PCAP),
98 .BR pcap_create (3PCAP),
99 .BR pcap_activate (3PCAP)