40 #ifndef included_vnet_pcap_h 41 #define included_vnet_pcap_h 45 #define foreach_vnet_pcap_packet_type \ 53 #define _(f,n) PCAP_PACKET_TYPE_##f = (n), 58 #define foreach_pcap_file_header \ 64 _ (u16, major_version) \ 65 _ (u16, minor_version) \ 74 _ (u32, max_packet_size_in_bytes) \ 86 #define foreach_pcap_packet_header \ 88 _ (u32, time_in_sec) \ 89 _ (u32, time_in_usec) \ 92 _ (u32, n_packet_bytes_stored_in_file) \ 93 _ (u32, n_bytes_in_packet) 118 #define PCAP_MAIN_INIT_DONE (1 << 0) 142 u32 n_bytes_in_trace,
143 u32 n_bytes_in_packet)
150 h->time_in_sec = time_now;
151 h->time_in_usec = 1e6*(time_now - h->time_in_sec);
152 h->n_packet_bytes_stored_in_file = n_bytes_in_trace;
153 h->n_bytes_in_packet = n_bytes_in_packet;
161 u32 n_bytes_in_trace)
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
clib_error_t * pcap_write(pcap_main_t *pm)
static void * pcap_add_packet(pcap_main_t *pm, f64 time_now, u32 n_bytes_in_trace, u32 n_bytes_in_packet)
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
#define foreach_pcap_packet_header
always_inline uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
#define VLIB_BUFFER_NEXT_PRESENT
u16 current_length
Nbytes between current data and the end of this buffer.
static void pcap_add_buffer(pcap_main_t *pm, vlib_main_t *vm, u32 buffer_index, u32 n_bytes_in_trace)
#define clib_memcpy(a, b, c)
u32 next_buffer
Next buffer for this linked-list of buffers.
clib_error_t * pcap_read(pcap_main_t *pm)
pcap_packet_type_t packet_type
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
always_inline f64 vlib_time_now(vlib_main_t *vm)
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
always_inline vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
#define foreach_vnet_pcap_packet_type
#define foreach_pcap_file_header