FD.io VPP  v19.08.3-2-gbabecb413
Vector Packet Processing
mpcap.c File Reference

mapped pcap file support More...

+ Include dependency graph for mpcap.c:

Go to the source code of this file.

Functions

clib_error_tmpcap_close (mpcap_main_t *pm)
 Close a mapped pcap file. More...
 
clib_error_tmpcap_init (mpcap_main_t *pm)
 Initialize a mapped pcap file. More...
 
clib_error_tmpcap_map (mpcap_main_t *pm)
 mmap a mapped pcap file, e.g. More...
 

Detailed Description

mapped pcap file support

Usage:

#include <vnet/unix/mpcap.h>

static mpcap_main_t mpcap = {
 .file_name = "/tmp/ip4",
 .n_packets_to_capture = 2,
 .packet_type = MPCAP_PACKET_TYPE_ip,
};

To add a buffer:

mpcap_add_buffer (&mpcap, vm, pi0, 128);

File will be written after n_packets_to_capture or call to mpcap_close

Definition in file mpcap.c.

Function Documentation

◆ mpcap_close()

clib_error_t* mpcap_close ( mpcap_main_t pm)

Close a mapped pcap file.

Flush / unmap a mpcap file.

Parameters
mpcap_main_t* pm
Returns
rc - clib_error_t

Definition at line 56 of file mpcap.c.

+ Here is the caller graph for this function:

◆ mpcap_init()

clib_error_t* mpcap_init ( mpcap_main_t pm)

Initialize a mapped pcap file.

initialize a mpcap file (for writing)

Parameters
mpcap_main_t* pm
Returns
rc - clib_error_t

Definition at line 85 of file mpcap.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mpcap_map()

clib_error_t* mpcap_map ( mpcap_main_t pm)

mmap a mapped pcap file, e.g.

mmap a mpcap data file.

to read from another process

Parameters
pcap_main_t*pm
Returns
rc - clib_error_t

Definition at line 164 of file mpcap.c.