1PCAP_INIT(3PCAP)                                              PCAP_INIT(3PCAP)
2
3
4

NAME

6       pcap_init - initialize the library
7

SYNOPSIS

9       #include <pcap/pcap.h>
10
11       char errbuf[PCAP_ERRBUF_SIZE];
12
13       int pcap_init(unsigned int opts, char *errbuf);
14

DESCRIPTION

16       pcap_init()  is  used  to  initialize the Packet Capture library.  opts
17       specifies options for the library; currently, the options are:
18
19       PCAP_CHAR_ENC_LOCAL
20              Treat all strings supplied as arguments, and return all  strings
21              to the caller, as being in the local character encoding.
22
23       PCAP_CHAR_ENC_UTF_8
24              Treat  all strings supplied as arguments, and return all strings
25              to the caller, as being in UTF-8.
26
27       On UNIX-like systems, the local character encoding  is  assumed  to  be
28       UTF-8, so no character encoding transformations are done.
29
30       On Windows, the local character encoding is the local ANSI code page.
31
32       If pcap_init() is not called, strings are treated as being in the local
33       ANSI code page on Windows, pcap_lookupdev(3PCAP) will succeed if  there
34       is  a  device  on  which  to  capture,  and pcap_create(3PCAP) makes an
35       attempt to check whether the string passed as an argument is a UTF-16LE
36       string  -  note that this attempt is unsafe, as it may run past the end
37       of the string - to handle pcap_lookupdev() returning a UTF-16LE string.
38       Programs   that   don't  call  pcap_init()  should,  on  Windows,  call
39       pcap_wsockinit() to  initialize  Winsock;  this  is  not  necessary  if
40       pcap_init() is called, as pcap_init() will initialize Winsock itself on
41       Windows.
42

RETURN VALUE

44       pcap_init() returns 0 on success and -1 on failure.  If -1 is returned,
45       errbuf  is  filled  in  with  an  appropriate error message.  errbuf is
46       assumed to be able to hold at least PCAP_ERRBUF_SIZE chars.
47

BACKWARD COMPATIBILITY

49       This function became available in libpcap release 1.10.0.  In  previous
50       releases,  on  Windows,  all  strings  supplied  as  arguments, and all
51       strings returned to the caller, are in the local character encoding.
52

SEE ALSO

54       pcap(3PCAP)
55
56
57
58                                 11 April 2020                PCAP_INIT(3PCAP)
Impressum