16 #ifndef included_vnet_mpcap_h 17 #define included_vnet_mpcap_h 35 f64 time_now,
u32 n_bytes_in_trace,
u32 n_bytes_in_packet)
45 pm->
current_va +=
sizeof (h[0]) + n_bytes_in_trace;
51 h->time_in_sec = time_now;
52 h->time_in_usec = 1e6 * (time_now - h->time_in_sec);
53 h->n_packet_bytes_stored_in_file = n_bytes_in_trace;
54 h->n_bytes_in_packet = n_bytes_in_packet;
72 f64 time_now,
u32 buffer_index,
u32 n_bytes_in_trace)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
u8 * file_baseva
Base address.
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
static_always_inline void clib_spinlock_unlock_if_init(clib_spinlock_t *p)
u16 current_length
Nbytes between current data and the end of this buffer.
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
#define clib_memcpy(d, s, n)
#define MPCAP_FLAG_INIT_DONE
MPCAP main state data structure.
MPCAP utility definitions.
clib_error_t * mpcap_close(mpcap_main_t *pm)
Flush / unmap a mpcap file.
static void mpcap_add_buffer(mpcap_main_t *pm, vlib_main_t *vm, f64 time_now, u32 buffer_index, u32 n_bytes_in_trace)
Add buffer (vlib_buffer_t) to the trace.
static void * mpcap_add_packet(mpcap_main_t *pm, f64 time_now, u32 n_bytes_in_trace, u32 n_bytes_in_packet)
Add packet.
u32 n_packets_captured
Number of packets currently captured.
clib_spinlock_t lock
spinlock, initialized if flagged MPCAP_FLAG_THREAD_SAFE
u32 next_buffer
Next buffer for this linked-list of buffers.
VLIB buffer representation.
u32 n_packets_to_capture
Number of packets to capture.
u64 max_file_size
Maximum file size.
static_always_inline void clib_spinlock_lock_if_init(clib_spinlock_t *p)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
u8 * current_va
current memory address