1 .\" @(#) $Header: /tcpdump/master/libpcap/Attic/pcap.3,v 1.59 2004-03-23 19:18:07 guy Exp $
3 .\" Copyright (c) 1994, 1996, 1997
4 .\" The Regents of the University of California. All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that: (1) source code distributions
8 .\" retain the above copyright notice and this paragraph in its entirety, (2)
9 .\" distributions including binary code include the above copyright notice and
10 .\" this paragraph in its entirety in the documentation or other materials
11 .\" provided with the distribution, and (3) all advertising materials mentioning
12 .\" features or use of this software display the following acknowledgement:
13 .\" ``This product includes software developed by the University of California,
14 .\" Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
15 .\" the University nor the names of its contributors may be used to endorse
16 .\" or promote products derived from this software without specific prior
17 .\" written permission.
18 .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
19 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
20 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22 .TH PCAP 3 "27 February 2004"
24 pcap \- Packet Capture library
33 char errbuf[PCAP_ERRBUF_SIZE];
37 pcap_t *pcap_open_live(const char *device, int snaplen,
39 int promisc, int to_ms, char *errbuf)
40 pcap_t *pcap_open_dead(int linktype, int snaplen)
41 pcap_t *pcap_open_offline(const char *fname, char *errbuf)
42 pcap_dumper_t *pcap_dump_open(pcap_t *p, const char *fname)
46 int pcap_setnonblock(pcap_t *p, int nonblock, char *errbuf);
47 int pcap_getnonblock(pcap_t *p, char *errbuf);
51 int pcap_findalldevs(pcap_if_t **alldevsp, char *errbuf)
52 void pcap_freealldevs(pcap_if_t *alldevs)
53 char *pcap_lookupdev(char *errbuf)
54 int pcap_lookupnet(const char *device, bpf_u_int32 *netp,
56 bpf_u_int32 *maskp, char *errbuf)
60 int pcap_dispatch(pcap_t *p, int cnt,
62 pcap_handler callback, u_char *user)
63 int pcap_loop(pcap_t *p, int cnt,
65 pcap_handler callback, u_char *user)
66 void pcap_dump(u_char *user, struct pcap_pkthdr *h,
72 int pcap_compile(pcap_t *p, struct bpf_program *fp,
74 char *str, int optimize, bpf_u_int32 netmask)
75 int pcap_setfilter(pcap_t *p, struct bpf_program *fp)
76 void pcap_freecode(struct bpf_program *);
80 const u_char *pcap_next(pcap_t *p, struct pcap_pkthdr *h)
81 int pcap_next_ex(pcap_t *p, struct pcap_pkthdr **pkt_header,
83 const u_char **pkt_data)
87 void pcap_breakloop(pcap_t *)
91 int pcap_inject(pcap_t *p, const void *buf, size_t size)
92 int pcap_sendpacket(pcap_t *p, const u_char *buf, int size)
96 int pcap_datalink(pcap_t *p)
97 int pcap_list_datalinks(pcap_t *p, int **dlt_buf);
98 int pcap_set_datalink(pcap_t *p, int dlt);
99 int pcap_datalink_name_to_val(const char *name);
100 const char *pcap_datalink_val_to_name(int dlt);
101 const char *pcap_datalink_val_to_description(int dlt);
102 int pcap_snapshot(pcap_t *p)
103 int pcap_is_swapped(pcap_t *p)
104 int pcap_major_version(pcap_t *p)
105 int pcap_minor_version(pcap_t *p)
106 int pcap_stats(pcap_t *p, struct pcap_stat *ps)
107 FILE *pcap_file(pcap_t *p)
108 int pcap_fileno(pcap_t *p)
109 int pcap_get_selectable_fd(pcap_t *p);
110 void pcap_perror(pcap_t *p, char *prefix)
111 char *pcap_geterr(pcap_t *p)
112 char *pcap_strerror(int error)
113 const char *pcap_lib_version(void)
117 void pcap_close(pcap_t *p)
118 int pcap_dump_flush(pcap_dumper_t *p)
119 FILE *pcap_dump_file(pcap_dumper_t *p)
120 void pcap_dump_close(pcap_dumper_t *p)
124 The Packet Capture library
125 provides a high level interface to packet capture systems. All packets
126 on the network, even those destined for other hosts, are accessible
127 through this mechanism.
133 .BR pcap_open_live() ,
134 .BR pcap_open_dead() ,
135 .BR pcap_open_offline() ,
136 .BR pcap_setnonblock() ,
137 .BR pcap_getnonblock() ,
138 .BR pcap_findalldevs() ,
139 .BR pcap_lookupdev() ,
142 is assumed to be able to hold at least
147 is used to obtain a packet capture descriptor to look
148 at packets on the network.
150 is a string that specifies the network device to open; on Linux systems
151 with 2.2 or later kernels, a
155 can be used to capture packets from all interfaces.
157 specifies the maximum number of bytes to capture. If this value is less
158 than the size of a packet that is captured, only the first
160 bytes of that packet will be captured and provided as packet data. A
161 value of 65535 should be sufficient, on most if not all networks, to
162 capture all the data available from the packet.
164 specifies if the interface is to be put into promiscuous mode.
165 (Note that even if this parameter is false, the interface
166 could well be in promiscuous mode for some other reason.) For now, this
167 doesn't work on the "any" device; if an argument of "any" or NULL is
172 specifies the read timeout in milliseconds. The read timeout is used to
173 arrange that the read not necessarily return immediately when a packet
174 is seen, but that it wait for some amount of time to allow more packets
175 to arrive and to read multiple packets from the OS kernel in one
176 operation. Not all platforms support a read timeout; on platforms that
177 don't, the read timeout is ignored. A zero value for
179 on platforms that support a read timeout,
180 will cause a read to wait forever to allow enough packets to
181 arrive, with no timeout.
183 is used to return error or warning text. It will be set to error text when
188 may also be set to warning text when
190 succeds; to detect this case the caller should store a zero-length string in
194 and display the warning to the user if
196 is no longer a zero-length string.
199 is used for creating a
201 structure to use when calling the other functions in libpcap. It is
202 typically used when just using libpcap for compiling BPF code.
204 .B pcap_open_offline()
205 is called to open a ``savefile'' for reading.
207 specifies the name of the file to open. The file has
208 the same format as those used by
212 The name "-" in a synonym for
215 is used to return error text and is only set when
216 .B pcap_open_offline()
221 is called to open a ``savefile'' for writing. The name "-" in a synonym
225 is returned on failure.
229 struct as returned by
230 .B pcap_open_offline()
232 .BR pcap_open_live() .
234 specifies the name of the file to open.
239 can be used to get the error text.
241 .B pcap_setnonblock()
242 puts a capture descriptor, opened with
243 .BR pcap_open_live() ,
244 into ``non-blocking'' mode, or takes it out of ``non-blocking'' mode,
245 depending on whether the
247 argument is non-zero or zero. It has no effect on ``savefiles''.
248 If there is an error, \-1 is returned and
250 is filled in with an appropriate error message; otherwise, 0 is
253 ``non-blocking'' mode, an attempt to read from the capture descriptor
256 will, if no packets are currently available to be read, return 0
257 immediately rather than blocking waiting for packets to arrive.
261 will not work in ``non-blocking'' mode.
263 .B pcap_getnonblock()
264 returns the current ``non-blocking'' state of the capture descriptor; it
265 always returns 0 on ``savefiles''.
266 If there is an error, \-1 is returned and
268 is filled in with an appropriate error message.
270 .B pcap_findalldevs()
271 constructs a list of network devices that can be opened with
272 .BR pcap_open_live() .
273 (Note that there may be network devices that cannot be opened with
277 .BR pcap_findalldevs() ,
278 because, for example, that process might not have sufficient privileges
279 to open them for capturing; if so, those devices will not appear on the
282 is set to point to the first element of the list; each element of the
285 and has the following members:
291 a pointer to the next element in the list;
293 for the last element of the list
296 a pointer to a string giving a name for the device to pass to
302 a pointer to a string giving a human-readable description of the device
305 a pointer to the first element of a list of addresses for the interface
312 set if the interface is a loopback interface
316 Each element of the list of addresses is of type
318 and has the following members:
324 a pointer to the next element in the list;
326 for the last element of the list
331 containing an address
338 that contains the netmask corresponding to the address pointed to by
346 that contains the broadcast address corresponding to the address pointed
349 may be null if the interface doesn't support broadcasts
356 that contains the destination address corresponding to the address pointed
359 may be null if the interface isn't a point-to-point interface
363 is returned on failure, in which case
365 is filled in with an appropriate error message;
367 is returned on success.
369 .B pcap_freealldevs()
370 is used to free a list allocated by
371 .BR pcap_findalldevs() .
374 returns a pointer to a network device suitable for use with
377 .BR pcap_lookupnet() .
378 If there is an error,
382 is filled in with an appropriate error message.
385 is used to determine the network number and mask
386 associated with the network device
395 A return of \-1 indicates an error in which case
397 is filled in with an appropriate error message.
400 is used to collect and process packets.
402 specifies the maximum number of packets to process before returning.
403 This is not a minimum number; when reading a live capture, only one
404 bufferful of packets is read at a time, so fewer than
406 packets may be processed. A
408 of \-1 processes all the packets received in one buffer when reading a
409 live capture, or all the packets in the file when reading a
412 specifies a routine to be called with three arguments:
415 pointer which is passed in from
416 .BR pcap_dispatch() ,
418 .I const struct pcap_pkthdr
419 pointer to a structure with the following members:
425 containing the time when the packet was captured
430 giving the number of bytes of the packet that are available from the
436 giving the length of the packet, in bytes (which might be more than the
437 number of bytes available from the capture, if the length of the packet
438 is larger than the maximum number of bytes to capture)
446 .I struct pcap_pkthdr
447 a pointer to which is passed to the callback routine)
448 bytes of data from the packet (which won't necessarily be the entire
449 packet; to capture the entire packet, you will have to provide a value
454 that is sufficiently large to get all of the packet's data - a value of
455 65535 should be sufficient on most if not all networks).
457 The number of packets read is returned.
458 0 is returned if no packets were read from a live capture (if, for
459 example, they were discarded because they didn't pass the packet filter,
460 or if, on platforms that support a read timeout that starts before any
461 packets arrive, the timeout expires before any packets arrive, or if the
462 file descriptor for the capture device is in non-blocking mode and no
463 packets were available to be read) or if no more packets are available
464 in a ``savefile.'' A return of \-1 indicates
465 an error in which case
469 may be used to display the error text.
470 A return of \-2 indicates that the loop terminated due to a call to
472 before any packets were processed.
474 If your application uses pcap_breakloop(),
475 make sure that you explicitly check for \-1 and \-2, rather than just
476 checking for a return value < 0.
480 when reading a live capture,
482 will not necessarily return when the read times out; on some platforms,
483 the read timeout isn't supported, and, on other platforms, the timer
484 doesn't start until at least one packet arrives. This means that the
487 be used in, for example, an interactive application, to allow the packet
488 capture loop to ``poll'' for user input periodically, as there's no
491 will return after the timeout expires.
496 except it keeps reading packets until
498 packets are processed or an error occurs.
501 return when live read timeouts occur.
502 Rather, specifying a non-zero read timeout to
506 allows the reception and processing of any packets that arrive when the
512 to loop forever (or at least until an error occurs). \-1 is returned on
513 an error; 0 is returned if
515 is exhausted; \-2 is returned if the loop terminated due to a call to
517 before any packets were processed.
519 If your application uses pcap_breakloop(),
520 make sure that you explicitly check for \-1 and \-2, rather than just
521 checking for a return value < 0.
525 reads the next packet (by calling
531 pointer to the data in that packet. (The
533 struct for that packet is not supplied.)
535 is returned if an error occured, or if no packets were read from a live
536 capture (if, for example, they were discarded because they didn't pass
537 the packet filter, or if, on platforms that support a read timeout that
538 starts before any packets arrive, the timeout expires before any packets
539 arrive, or if the file descriptor for the capture device is in
540 non-blocking mode and no packets were available to be read), or if no
541 more packets are available in a ``savefile.'' Unfortunately, there is
542 no way to determine whether an error occured or not.
545 reads the next packet and returns a success/failure indication:
549 the packet was read without problems
552 packets are being read from a live capture, and the timeout expired
555 an error occurred while reading the packet
558 packets are being read from a ``savefile'', and there are no more
559 packets to read from the savefile.
562 If the packet was read without problems, the pointer pointed to by the
564 argument is set to point to the
566 struct for the packet, and the
567 pointer pointed to by the
569 argument is set to point to the data in the packet.
572 sets a flag that will force
576 to return rather than looping; they will return the number of packets
577 that have been processed so far, or \-2 if no packets have been
580 This routine is safe to use inside a signal handler on UNIX or a console
581 control handler on Windows, as it merely sets a flag that is checked
584 The flag is checked in loops reading packets from the OS - a signal by
585 itself will not necessarily terminate those loops - as well as in loops
586 processing a set of packets returned by the OS.
588 Note that if you are catching signals on UNIX systems that support
589 restarting system calls after a signal, and calling pcap_breakloop()
590 in the signal handler, you must specify, when catching those signals,
591 that system calls should NOT be restarted by that signal. Otherwise,
592 if the signal interrupted a call reading packets in a live capture,
593 when your signal handler returns after calling pcap_breakloop(), the
594 call will be restarted, and the loop will not terminate until more
595 packets arrive and the call completes.
597 Note also that, in a multi-threaded application, if one thread is
599 .BR pcap_dispatch() ,
606 in a different thread will not unblock that thread; you will need to use
607 whatever mechanism the OS provides for breaking a thread out of blocking
608 calls in order to unblock the thread, such as thread cancellation in
609 systems that support POSIX threads.
614 will, on some platforms, loop reading packets from the OS; that loop
615 will not necessarily be terminated by a signal, so
617 should be used to terminate packet processing even if
622 does not guarantee that no further packets will be processed by
626 after it is called; at most one more packet might be processed.
628 If \-2 is returned from
632 the flag is cleared, so a subsequent call will resume reading packets.
633 If a positive number is returned, the flag is not cleared, so a
634 subsequent call will return \-2 and clear the flag.
637 sends a raw packet through the network interface;
639 points to the data of the packet, including the link-layer header, and
641 is the number of bytes in the packet.
642 It returns the number of bytes written on success. A return of \-1
643 indicates an error in which case
647 may be used to display the error text.
648 Note that, even if you successfully open the network interface, you
649 might not have permission to send packets on it, or it might not support
652 doesn't have a flag to indicate whether to open for capturing, sending,
653 or capturing and sending, you cannot request an open that supports
654 sending and be notified at open time whether sending will be possible.
655 Note also that some devices might not support sending packets.
660 but it returns 0 on success and \-1 on failure.
664 comes from WinPcap. Both are provided for compatibility.)
667 outputs a packet to the ``savefile'' opened with
668 .BR pcap_dump_open() .
669 Note that its calling arguments are suitable for use with
673 If called directly, the
678 .BR pcap_dump_open() .
681 is used to compile the string
683 into a filter program.
687 struct and is filled in by
690 controls whether optimization on the resulting code is performed.
692 specifies the IPv4 netmask of the network on which packets are being
693 captured; it is used only when checking for IPv4 broadcast addresses in
694 the filter program. If the netmask of the network on which packets are
695 being captured isn't known to the program, or if packets are being
696 captured on the Linux "any" pseudo-interface that can capture on more
697 than one network, a value of 0 can be supplied; tests for IPv4 broadcast
698 addreses won't be done correctly, but all other tests in the filter
699 program will be OK. A return of \-1 indicates an error in which case
701 may be used to display the error text.
703 .B pcap_compile_nopcap()
706 except that instead of passing a pcap structure, one passes the
707 snaplen and linktype explicitly. It is intended to be used for
708 compiling filters for direct BPF usage, without necessarily having
711 A return of \-1 indicates an error; the error text is unavailable.
712 .RB ( pcap_compile_nopcap()
714 .BR pcap_open_dead() ,
718 the latter three routines can be used directly in order to get the error
719 text for a compilation error.)
723 is used to specify a filter program.
727 struct, usually the result of a call to
730 is returned on failure, in which case
732 may be used to display the error text;
734 is returned on success.
737 is used to free up allocated memory pointed to by a
741 when that BPF program is no longer needed, for example after it
742 has been made the filter program for a pcap structure by a call to
743 .BR pcap_setfilter() .
746 returns the link layer type; link layer types it can return include:
751 BSD loopback encapsulation; the link layer header is a 4-byte field, in
753 byte order, containing a PF_ value from
755 for the network-layer protocol of the packet.
757 Note that ``host byte order'' is the byte order of the machine on which
758 the packets are captured, and the PF_ values are for the OS of the
759 machine on which the packets are captured; if a live capture is being
760 done, ``host byte order'' is the byte order of the machine capturing the
761 packets, and the PF_ values are those of the OS of the machine capturing
762 the packets, but if a ``savefile'' is being read, the byte order and PF_
765 necessarily those of the machine reading the capture file.
768 Ethernet (10Mb, 100Mb, 1000Mb, and up)
771 IEEE 802.5 Token Ring
777 SLIP; the link layer header contains, in order:
780 a 1-byte flag, which is 0 for packets received by the machine and 1 for
781 packets sent by the machine;
783 a 1-byte field, the upper 4 bits of which indicate the type of packet,
788 an unmodified IP datagram (TYPE_IP);
791 an uncompressed-TCP IP datagram (UNCOMPRESSED_TCP), with that byte being
792 the first byte of the raw IP header on the wire, containing the
793 connection number in the protocol field;
796 a compressed-TCP IP datagram (COMPRESSED_TCP), with that byte being the
797 first byte of the compressed TCP/IP datagram header;
800 for UNCOMPRESSED_TCP, the rest of the modified IP header, and for
801 COMPRESSED_TCP, the compressed TCP/IP datagram header;
805 for a total of 16 bytes; the uncompressed IP datagram follows the header.
809 PPP; if the first 2 bytes are 0xff and 0x03, it's PPP in HDLC-like
810 framing, with the PPP header following those two bytes, otherwise it's
811 PPP without framing, and the packet begins with the PPP header.
817 RFC 1483 LLC/SNAP-encapsulated ATM; the packet begins with an IEEE 802.2
821 raw IP; the packet begins with an IP header.
824 PPP in HDLC-like framing, as per RFC 1662, or Cisco PPP with HDLC
825 framing, as per section 4.3.1 of RFC 1547; the first byte will be 0xFF
826 for PPP in HDLC-like framing, and will be 0x0F or 0x8F for Cisco PPP
830 PPPoE; the packet begins with a PPPoE header, as per RFC 2516.
833 Cisco PPP with HDLC framing, as per section 4.3.1 of RFC 1547.
836 IEEE 802.11 wireless LAN
842 OpenBSD loopback encapsulation; the link layer header is a 4-byte field, in
844 byte order, containing a PF_ value from OpenBSD's
846 for the network-layer protocol of the packet.
848 Note that, if a ``savefile'' is being read, those PF_ values are
850 necessarily those of the machine reading the capture file.
853 Linux "cooked" capture encapsulation; the link layer header contains, in
857 a 2-byte "packet type", in network byte order, which is one of:
861 packet was sent to us by somebody else
864 packet was broadcast by somebody else
867 packet was multicast, but not broadcast, by somebody else
870 packet was sent by somebody else to somebody else
873 packet was sent by us
876 a 2-byte field, in network byte order, containing a Linux ARPHRD_ value
877 for the link layer device type;
879 a 2-byte field, in network byte order, containing the length of the
880 link layer address of the sender of the packet (which could be 0);
882 an 8-byte field containing that number of bytes of the link layer header
883 (if there are more than 8 bytes, only the first 8 are present);
885 a 2-byte field containing an Ethernet protocol type, in network byte
886 order, or containing 1 for Novell 802.3 frames without an 802.2 LLC
887 header or 4 for frames beginning with an 802.2 LLC header.
891 Apple LocalTalk; the packet begins with an AppleTalk LLAP header.
894 OpenBSD pflog; the link layer header contains, in order:
897 a 4-byte PF_ value, in network byte order;
899 a 16-character interface name;
901 a 2-byte rule number, in network byte order;
903 a 2-byte reason code, in network byte order, which is one of:
924 a 2-byte action code, in network byte order, which is one of:
937 a 2-byte direction, in network byte order, which is one of:
952 Prism monitor mode information followed by an 802.11 header.
955 RFC 2625 IP-over-Fibre Channel, with the link-layer header being the
956 Network_Header as described in that RFC.
959 SunATM devices; the link layer header contains, in order:
962 a 1-byte flag field, containing a direction flag in the uppermost bit,
963 which is set for packets transmitted by the machine and clear for
964 packets received by the machine, and a 4-byte traffic type in the
965 low-order 4 bits, which is one of:
975 LLC-encapsulated traffic
992 a 2-byte VCI field, in network byte order.
995 .B DLT_IEEE802_11_RADIO
996 link-layer information followed by an 802.11 header - see
997 http://www.shaftnet.org/~pizza/software/capturefrm.txt for a description
998 of the link-layer information.
1001 ARCNET, with no exception frames, reassembled packets rather than raw
1002 frames, and an extra 16-bit offset field between the destination host
1006 Linux-IrDA packets, with a
1008 header followed by the IrLAP header.
1011 .B pcap_list_datalinks()
1012 is used to get a list of the supported data link types of the interface
1013 associated with the pcap descriptor.
1014 .B pcap_list_datalinks()
1015 allocates an array to hold the list and sets
1017 The caller is responsible for freeing the array.
1019 is returned on failure;
1020 otherwise, the number of data link types in the array is returned.
1022 .B pcap_set_datalink()
1023 is used to set the current data link type of the pcap descriptor
1024 to the type specified by
1027 is returned on failure.
1029 .B pcap_datalink_name_to_val()
1030 translates a data link type name, which is a
1034 removed, to the corresponding data link type value. The translation
1035 is case-insensitive.
1037 is returned on failure.
1039 .B pcap_datalink_val_to_name()
1040 translates a data link type value to the corresponding data link type
1041 name. NULL is returned on failure.
1043 .B pcap_datalink_val_to_description()
1044 translates a data link type value to a short description of that data
1045 link type. NULL is returned on failure.
1048 returns the snapshot length specified when
1052 .B pcap_is_swapped()
1053 returns true if the current ``savefile'' uses a different byte order
1054 than the current system.
1056 .B pcap_major_version()
1057 returns the major number of the file format of the savefile;
1058 .B pcap_minor_version()
1059 returns the minor number of the file format of the savefile. The
1060 version number is stored in the header of the savefile.
1063 returns the standard I/O stream of the ``savefile,'' if a ``savefile''
1065 .BR pcap_open_offline() ,
1066 or NULL, if a network device was opened with
1067 .BR pcap_open_live() .
1070 returns 0 and fills in a
1072 struct. The values represent packet statistics from the start of the
1073 run to the time of the call. If there is an error or the underlying
1074 packet capture doesn't support packet statistics, \-1 is returned and
1075 the error text can be obtained with
1080 is supported only on live captures, not on ``savefiles''; no statistics
1081 are stored in ``savefiles'', so no statistics are available when reading
1082 from a ``savefile''.
1085 returns the file descriptor number from which captured packets are read,
1086 if a network device was opened with
1087 .BR pcap_open_live() ,
1088 or \-1, if a ``savefile'' was opened with
1089 .BR pcap_open_offline() .
1091 .B pcap_get_selectable_fd()
1092 returns, on UNIX, a file descriptor number for a file descriptor on
1098 to wait for it to be possible to read packets without blocking, if such
1099 a descriptor exists, or \-1, if no such descriptor exists. Some network
1106 (for example, regular network devices on FreeBSD 4.3 and 4.4, and Endace
1107 DAG devices), so \-1 is returned for those devices.
1109 Note that on most versions of most BSDs (including Mac OS X)
1113 do not work correctly on BPF devices;
1114 .B pcap_get_selectable_fd()
1115 will return a file descriptor on most of those versions (the exceptions
1116 being FreeBSD 4.3 and 4.4), a simple
1120 will not return even after a timeout specified in
1122 expires. To work around this, an application that uses
1126 to wait for packets to arrive must put the
1128 in non-blocking mode, and must arrange that the
1132 have a timeout less than or equal to the timeout specified in
1133 .BR pcap_open_live() ,
1134 and must try to read packets after that timeout expires, regardless of
1139 indicated that the file descriptor for the
1141 is ready to be read or not. (That workaround will not work in FreeBSD
1142 4.3 and later; however, in FreeBSD 4.6 and later,
1146 work correctly on BPF devices, so the workaround isn't necessary,
1147 although it does no harm.)
1149 .B pcap_get_selectable_fd()
1150 is not available on Windows.
1153 prints the text of the last pcap library error on
1159 returns the error text pertaining to the last pcap library error.
1161 the pointer it returns will no longer point to a valid error message
1164 passed to it is closed; you must use or copy the string before closing
1173 .B pcap_lib_version()
1174 returns a pointer to a string giving information about the version of
1175 the libpcap library being used; note that it contains more information
1176 than just a version number.
1179 closes the files associated with
1181 and deallocates resources.
1184 returns the standard I/O stream of the ``savefile'' opened by
1185 .BR pcap_dump_open().
1187 .B pcap_dump_flush()
1188 flushes the output buffer to the ``savefile,'' so that any packets
1191 but not yet written to the ``savefile'' will be written.
1193 is returned on error, 0 on success.
1195 .B pcap_dump_close()
1196 closes the ``savefile.''
1199 tcpdump(1), tcpslice(1)
1201 The original authors are:
1205 Steven McCanne, all of the
1206 Lawrence Berkeley National Laboratory, University of California, Berkeley, CA.
1208 The current version is available from "The Tcpdump Group"'s Web site at
1211 .I http://www.tcpdump.org/
1214 Please send problems, bugs, questions, desirable enhancements, etc. to:
1217 tcpdump-workers@tcpdump.org
1220 Please send source code contributions, etc. to: