FD.io VPP  v21.01.1
Vector Packet Processing
mpcap.h File Reference

MPCAP utility definitions. More...

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

Go to the source code of this file.

Data Structures

struct  mpcap_file_header_t
 File header struct. More...
 
struct  mpcap_packet_header_t
 Packet header. More...
 
struct  mpcap_main_t
 MPCAP main state data structure. More...
 

Macros

#define foreach_vnet_mpcap_packet_type
 Packet types supported by MPCAP. More...
 
#define foreach_mpcap_file_header
 
#define foreach_mpcap_packet_header
 
#define MPCAP_FLAG_INIT_DONE   (1 << 0)
 
#define MPCAP_FLAG_THREAD_SAFE   (1 << 1)
 
#define MPCAP_FLAG_WRITE_ENABLE   (1 << 2)
 
#define MPCAP_DEFAULT_FILE_SIZE   (10<<20)
 

Enumerations

enum  mpcap_packet_type_t { foreach_vnet_mpcap_packet_type }
 

Functions

clib_error_tmpcap_init (mpcap_main_t *pm)
 initialize a mpcap file (for writing) More...
 
clib_error_tmpcap_close (mpcap_main_t *pm)
 Flush / unmap a mpcap file. More...
 
clib_error_tmpcap_map (mpcap_main_t *pm)
 mmap a mpcap data file. More...
 

Detailed Description

MPCAP utility definitions.

Definition in file mpcap.h.

Macro Definition Documentation

◆ foreach_mpcap_file_header

#define foreach_mpcap_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_mpcap_packet_type_t. */ \
_ (u32, packet_type)
unsigned int u32
Definition: types.h:88
unsigned short u16
Definition: types.h:57

Definition at line 52 of file mpcap.h.

◆ foreach_mpcap_packet_header

#define foreach_mpcap_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 81 of file mpcap.h.

◆ foreach_vnet_mpcap_packet_type

#define foreach_vnet_mpcap_packet_type
Value:
_ (null, 0) \
_ (ethernet, 1) \
_ (ppp, 9) \
_ (ip, 12) \
_ (hdlc, 104)
rpc memclnt_read_timeout returns null
Definition: memclnt.api:24
vl_api_address_t ip
Definition: l2.api:501

Packet types supported by MPCAP.

null 0 ethernet 1 ppp 9 ip 12 hdlc 104

Definition at line 38 of file mpcap.h.

◆ MPCAP_DEFAULT_FILE_SIZE

#define MPCAP_DEFAULT_FILE_SIZE   (10<<20)

Definition at line 154 of file mpcap.h.

◆ MPCAP_FLAG_INIT_DONE

#define MPCAP_FLAG_INIT_DONE   (1 << 0)

Definition at line 136 of file mpcap.h.

◆ MPCAP_FLAG_THREAD_SAFE

#define MPCAP_FLAG_THREAD_SAFE   (1 << 1)

Definition at line 137 of file mpcap.h.

◆ MPCAP_FLAG_WRITE_ENABLE

#define MPCAP_FLAG_WRITE_ENABLE   (1 << 2)

Definition at line 138 of file mpcap.h.

Enumeration Type Documentation

◆ mpcap_packet_type_t

Enumerator
foreach_vnet_mpcap_packet_type 

Definition at line 45 of file mpcap.h.

Function Documentation

◆ mpcap_close()

clib_error_t* mpcap_close ( mpcap_main_t pm)

Flush / unmap a mpcap 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 mpcap file (for writing)

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 mpcap data file.

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.

+ Here is the call graph for this function: