16 #ifndef included_vppinfra_pcap_funcs_h 17 #define included_vppinfra_pcap_funcs_h 38 f64 time_now,
u32 n_bytes_in_trace,
u32 n_bytes_in_packet)
45 h->time_in_sec = time_now;
46 h->time_in_usec = 1e6 * (time_now - h->time_in_sec);
47 h->n_packet_bytes_stored_in_file = n_bytes_in_trace;
48 h->n_bytes_in_packet = n_bytes_in_packet;
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
u32 n_packets_to_capture
Number of packets to capture.
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
#define clib_memcpy_fast(a, b, c)
static f64 vlib_time_now(vlib_main_t *vm)
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.
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
PCAP main state data structure.
clib_spinlock_t lock
spinlock to protect e.g.
clib_error_t * pcap_read(pcap_main_t *pm)
Read data from file.
u8 * pcap_data
Vector of pcap data.
static void * pcap_add_packet(pcap_main_t *pm, f64 time_now, u32 n_bytes_in_trace, u32 n_bytes_in_packet)
Add packet.
clib_error_t * pcap_write(pcap_main_t *pm)
Write out data to output file.
u32 next_buffer
Next buffer for this linked-list of buffers.
VLIB buffer representation.
static void pcap_add_buffer(pcap_main_t *pm, struct vlib_main_t *vm, u32 buffer_index, u32 n_bytes_in_trace)
Add buffer (vlib_buffer_t) to the trace.
static_always_inline void clib_spinlock_lock_if_init(clib_spinlock_t *p)
u32 n_packets_captured
Number of packets currently captured.
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.