FD.io VPP  v18.01.2-1-g9b554f3
Vector Packet Processing
pcap.h File Reference

PCAP utility definitions. More...

+ Include dependency graph for pcap.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  pcap_file_header_t
 File header struct. More...
 
struct  pcap_packet_header_t
 Packet header. More...
 
struct  pcap_main_t
 PCAP main state data structure. More...
 

Macros

#define foreach_vnet_pcap_packet_type
 Packet types supported by PCAP. More...
 
#define foreach_pcap_file_header
 
#define foreach_pcap_packet_header
 
#define PCAP_MAIN_INIT_DONE   (1 << 0)
 

Enumerations

enum  pcap_packet_type_t { foreach_vnet_pcap_packet_type }
 

Functions

clib_error_tpcap_write (pcap_main_t *pm)
 Write out data to output file. More...
 
clib_error_tpcap_read (pcap_main_t *pm)
 Read data from file. More...
 
static void * pcap_add_packet (pcap_main_t *pm, f64 time_now, u32 n_bytes_in_trace, u32 n_bytes_in_packet)
 Add packet. More...
 
static void pcap_add_buffer (pcap_main_t *pm, vlib_main_t *vm, u32 buffer_index, u32 n_bytes_in_trace)
 Add buffer (vlib_buffer_t) to the trace. More...
 

Detailed Description

PCAP utility definitions.

Definition in file pcap.h.

Macro Definition Documentation

#define foreach_pcap_file_header
Value:
/** 0xa1b2c3d4 host byte order. \
0xd4c3b2a1 => need to byte swap everything. */ \
_ (u32, magic) \
\
/** Currently major 2 minor 4. */ \
_ (u16, major_version) \
_ (u16, minor_version) \
\
/** 0 for GMT. */ \
_ (u32, time_zone) \
\
/** Accuracy of timestamps. Typically set to 0. */ \
_ (u32, sigfigs) \
\
/** Size of largest packet in file. */ \
_ (u32, max_packet_size_in_bytes) \
\
/** One of vnet_pcap_packet_type_t. */ \
_ (u32, packet_type)
unsigned int u32
Definition: types.h:88
unsigned short u16
Definition: types.h:57

Definition at line 71 of file pcap.h.

#define foreach_pcap_packet_header
Value:
/** Time stamp in seconds */ \
_ (u32, time_in_sec) \
/** Time stamp in microseconds. */ \
_ (u32, time_in_usec) \
\
/** Number of bytes stored in file. */ \
_ (u32, n_packet_bytes_stored_in_file) \
/** Number of bytes in actual packet. */ \
_ (u32, n_bytes_in_packet)
unsigned int u32
Definition: types.h:88

Definition at line 100 of file pcap.h.

#define foreach_vnet_pcap_packet_type
Value:
_ (null, 0) \
_ (ethernet, 1) \
_ (ppp, 9) \
_ (ip, 12) \
_ (hdlc, 104)

Packet types supported by PCAP.

null 0 ethernet 1 ppp 9 ip 12 hdlc 104

Definition at line 57 of file pcap.h.

#define PCAP_MAIN_INIT_DONE   (1 << 0)

Definition at line 140 of file pcap.h.

Enumeration Type Documentation

Enumerator
foreach_vnet_pcap_packet_type 

Definition at line 64 of file pcap.h.

Function Documentation

static void pcap_add_buffer ( pcap_main_t pm,
vlib_main_t vm,
u32  buffer_index,
u32  n_bytes_in_trace 
)
inlinestatic

Add buffer (vlib_buffer_t) to the trace.

Parameters
*pm- pcap_main_t
*vm- vlib_main_t
buffer_index- u32
n_bytes_in_trace- u32

Flush output vector.

Definition at line 202 of file pcap.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void* pcap_add_packet ( pcap_main_t pm,
f64  time_now,
u32  n_bytes_in_trace,
u32  n_bytes_in_packet 
)
inlinestatic

Add packet.

Parameters
*pm- pcap_main_t
time_now- f64
n_bytes_in_trace- u32
n_bytes_in_packet- u32
Returns
Packet Data

Definition at line 176 of file pcap.h.

+ Here is the caller graph for this function:

clib_error_t* pcap_read ( pcap_main_t pm)

Read data from file.

Read data from file.

Returns
rc - clib_error_t

Definition at line 178 of file pcap.c.

+ Here is the caller graph for this function:

clib_error_t* pcap_write ( pcap_main_t pm)

Write out data to output file.

Write out data to output 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: