44 #define foreach_tcp_flag \ 60 u32 ip_offset, tcp_offset;
63 ip_offset = (g - 1)->start_byte_offset;
65 while (n_packets >= 1)
78 ip0 = (
void *) (p0->
data + ip_offset);
79 tcp0 = (
void *) (p0->
data + tcp_offset);
84 tcp_len0 = clib_net_to_host_u16 (ip0->
length) - tcp_offset;
87 if (
BITS (sum0) == 32)
98 (sum0, clib_host_to_net_u32 (tcp_len0 + (ip0->
protocol << 16)));
115 #define _(f) pg_edit_t f##_flag; 127 #define _(f) pg_edit_init (&p->f, tcp_header_t, f); 139 pg_edit_init_bitfield (&p->f##_flag, tcp_header_t, \ 141 TCP_FLAG_BIT_##f, 1); 146 data_offset_and_reserved, 4, 4);
170 #define _(f) pg_edit_set_fixed (&p->f##_flag, 0); 175 if (!
unformat (input,
"TCP: %U -> %U",
188 else if (
unformat (input,
"checksum %U",
199 #define _(f) else if (unformat (input, #f)) pg_edit_set_fixed (&p->f##_flag, 1);
static ip_csum_t ip_incremental_checksum_buffer(vlib_main_t *vm, vlib_buffer_t *first_buffer, u32 first_buffer_offset, u32 n_bytes_to_checksum, ip_csum_t sum)
static void pg_edit_set_fixed(pg_edit_t *e, u64 value)
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
void(* edit_function)(struct pg_main_t *pg, struct pg_stream_t *s, struct pg_edit_group_t *g, u32 *buffers, u32 n_buffers)
uword unformat_pg_edit(unformat_input_t *input, va_list *args)
static ip_csum_t ip_csum_with_carry(ip_csum_t sum, ip_csum_t x)
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
struct _tcp_header tcp_header_t
static pg_edit_group_t * pg_stream_get_group(pg_stream_t *s, u32 group_index)
uword unformat_pg_payload(unformat_input_t *input, va_list *args)
static void * pg_create_edit_group(pg_stream_t *s, int n_edit_bytes, int n_packet_bytes, u32 *group_index)
static u64 pg_edit_get_value(pg_edit_t *e, int hi_or_lo)
#define pg_edit_init_bitfield(e, type, field, field_offset, field_n_bits)
static void tcp_pg_edit_function(pg_main_t *pg, pg_stream_t *s, pg_edit_group_t *g, u32 *packets, u32 n_packets)
static tcp_udp_port_info_t * ip_get_tcp_udp_port_info(ip_main_t *im, u32 port)
unformat_function_t * unformat_pg_edit
static void pg_free_edit_group(pg_stream_t *s)
#define clib_mem_unaligned(pointer, type)
uword edit_function_opaque
static vlib_main_t * vlib_get_main(void)
VLIB buffer representation.
uword unformat_pg_tcp_header(unformat_input_t *input, va_list *args)
uword unformat_pg_number(unformat_input_t *input, va_list *args)
static void pg_tcp_header_init(pg_tcp_header_t *p)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static u16 ip_csum_fold(ip_csum_t c)