Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

pcap_dump_open(3pcap) [mojave man page]

PCAP_DUMP_OPEN(3PCAP)													     PCAP_DUMP_OPEN(3PCAP)

NAME
pcap_dump_open, pcap_dump_fopen - open a file to which to write packets SYNOPSIS
#include <pcap/pcap.h> pcap_dumper_t *pcap_dump_open(pcap_t *p, const char *fname); pcap_dumper_t *pcap_dump_open_append(pcap_t *p, const char *fname); pcap_dumper_t *pcap_dump_fopen(pcap_t *p, FILE *fp); DESCRIPTION
pcap_dump_open() is called to open a ``savefile'' for writing. fname specifies the name of the file to open. The file will have the same format as those used by tcpdump(1) and tcpslice(1). The name "-" is a synonym for stdout. pcap_dump_fopen() is called to write data to an existing open stream fp. Note that on Windows, that stream should be opened in binary mode. p is a capture or ``savefile'' handle returned by an earlier call to pcap_create() and activated by an earlier call to pcap_activate(), or returned by an earlier call to pcap_open_offline(), pcap_open_live(), or pcap_open_dead(). The time stamp precision, link-layer type, and snapshot length from p are used as the link-layer type and snapshot length of the output file. pcap_dump_open_append() is like pcap_dump_open but does not create the file if it does not exist and, if it does already exist, and is a pcap file with the same byte order as the host opening the file, and has the same time stamp precision, link-layer header type, and snap- shot length as p, it will write new packets at the end of the file. RETURN VALUES
A pointer to a pcap_dumper_t structure to use in subsequent pcap_dump() and pcap_dump_close() calls is returned on success. NULL is returned on failure. If NULL is returned, pcap_geterr(p) can be used to get the error text. SEE ALSO
pcap(3PCAP), pcap_create(3PCAP), pcap_activate(3PCAP), pcap_open_offline(3PCAP), pcap_open_live(3PCAP), pcap_open_dead(3PCAP), pcap_dump(3PCAP), pcap_dump_close(3PCAP), pcap_geterr(3PCAP), pcap-savefile(5@) 16 February 2015 PCAP_DUMP_OPEN(3PCAP)

Check Out this Related Man Page

PCAP_INJECT(3PCAP)														PCAP_INJECT(3PCAP)

NAME
pcap_inject, pcap_sendpacket - transmit a packet SYNOPSIS
#include <pcap/pcap.h> int pcap_inject(pcap_t *p, const void *buf, size_t size); int pcap_sendpacket(pcap_t *p, const u_char *buf, int size); DESCRIPTION
pcap_inject() sends a raw packet through the network interface; buf points to the data of the packet, including the link-layer header, and size is the number of bytes in the packet. Note that, even if you successfully open the network interface, you might not have permission to send packets on it, or it might not sup- port sending packets; as pcap_open_live() doesn't have a flag to indicate whether to open for capturing, sending, or capturing and sending, you cannot request an open that supports sending and be notified at open time whether sending will be possible. Note also that some devices might not support sending packets. Note that, on some platforms, the link-layer header of the packet that's sent might not be the same as the link-layer header of the packet supplied to pcap_inject(), as the source link-layer address, if the header contains such an address, might be changed to be the address assigned to the interface on which the packet it sent, if the platform doesn't support sending completely raw and unchanged packets. Even worse, some drivers on some platforms might change the link-layer type field to whatever value libpcap used when attaching to the device, even on platforms that do nominally support sending completely raw and unchanged packets. pcap_sendpacket() is like pcap_inject(), but it returns 0 on success, rather than returning the number of bytes written. (pcap_inject() comes from OpenBSD; pcap_sendpacket() comes from WinPcap. Both are provided for compatibility.) RETURN VALUE
pcap_inject() returns the number of bytes written on success and -1 on failure. pcap_sendpacket() returns 0 on success and -1 on failure. If -1 is returned, pcap_geterr() or pcap_perror() may be called with p as an argument to fetch or display the error text. SEE ALSO
pcap(3PCAP), pcap_geterr(3PCAP) 3 January 2014 PCAP_INJECT(3PCAP)
Man Page