FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
pcap.c File Reference

PCAP function. More...

+ Include dependency graph for pcap.c:

Go to the source code of this file.

Functions

__clib_export clib_error_tpcap_close (pcap_main_t *pm)
 Close PCAP file. More...
 
__clib_export clib_error_tpcap_write (pcap_main_t *pm)
 Write PCAP file. More...
 
__clib_export clib_error_tpcap_read (pcap_main_t *pm)
 Read PCAP file. More...
 

Detailed Description

PCAP function.

Usage:

#include <vppinfra/pcap.h>

static pcap_main_t pcap = {
 .file_name = "/tmp/ip4",
 .n_packets_to_capture = 2,
 .packet_type = PCAP_PACKET_TYPE_ip,
};

To add a buffer:

pcap_add_buffer (&pcap, vm, pi0, 128);

File will be written after n_packets_to_capture or call to pcap_write (&pcap).

Definition in file pcap.c.

Function Documentation

◆ pcap_close()

clib_error_t * pcap_close ( pcap_main_t pm)

Close PCAP file.

Write out data to output file.

Close the file created by pcap_write function.

Returns
rc - clib_error_t

Definition at line 74 of file pcap.c.

+ Here is the caller graph for this function:

◆ pcap_read()

__clib_export clib_error_t* pcap_read ( pcap_main_t pm)

Read PCAP file.

Read data from file.

Returns
rc - clib_error_t

Definition at line 176 of file pcap.c.

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

◆ pcap_write()

__clib_export clib_error_t* pcap_write ( pcap_main_t pm)

Write PCAP file.

Returns
rc - clib_error_t

Definition at line 89 of file pcap.c.

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