40 #ifndef included_ip4_packet_h 41 #define included_ip4_packet_h 86 case 0xff: result += 8;
break;
87 case 0xfe: result += 7;
goto done;
88 case 0xfc: result += 6;
goto done;
89 case 0xf8: result += 5;
goto done;
90 case 0xf0: result += 4;
goto done;
91 case 0xe0: result += 3;
goto done;
92 case 0xc0: result += 2;
goto done;
93 case 0x80: result += 1;
goto done;
94 case 0x00: result += 0;
goto done;
122 #define IP4_HEADER_FLAG_MORE_FRAGMENTS (1 << 13) 123 #define IP4_HEADER_FLAG_DONT_FRAGMENT (1 << 14) 124 #define IP4_HEADER_FLAG_CONGESTION (1 << 15) 147 u64 checksum_data_64[2];
148 u32 checksum_data_64_32[1];
153 u32 checksum_data_32[5];
158 #define IP4_VERSION_AND_HEADER_LENGTH_NO_OPTIONS \ 159 ((4 << 4) | (sizeof (ip4_header_t) / sizeof (u32))) 208 if (csum == 0 && save == 0xffff)
218 #define ip4_partial_header_checksum_x1(ip0,sum0) \ 220 if (BITS (ip_csum_t) > 32) \ 222 sum0 = ip0->checksum_data_64[0]; \ 223 sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_64[1]); \ 224 sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_64_32[0]); \ 228 sum0 = ip0->checksum_data_32[0]; \ 229 sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_32[1]); \ 230 sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_32[2]); \ 231 sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_32[3]); \ 232 sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_32[4]); \ 236 #define ip4_partial_header_checksum_x2(ip0,ip1,sum0,sum1) \ 238 if (BITS (ip_csum_t) > 32) \ 240 sum0 = ip0->checksum_data_64[0]; \ 241 sum1 = ip1->checksum_data_64[0]; \ 242 sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_64[1]); \ 243 sum1 = ip_csum_with_carry (sum1, ip1->checksum_data_64[1]); \ 244 sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_64_32[0]); \ 245 sum1 = ip_csum_with_carry (sum1, ip1->checksum_data_64_32[0]); \ 249 sum0 = ip0->checksum_data_32[0]; \ 250 sum1 = ip1->checksum_data_32[0]; \ 251 sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_32[1]); \ 252 sum1 = ip_csum_with_carry (sum1, ip1->checksum_data_32[1]); \ 253 sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_32[2]); \ 254 sum1 = ip_csum_with_carry (sum1, ip1->checksum_data_32[2]); \ 255 sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_32[3]); \ 256 sum1 = ip_csum_with_carry (sum1, ip1->checksum_data_32[3]); \ 257 sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_32[4]); \ 258 sum1 = ip_csum_with_carry (sum1, ip1->checksum_data_32[4]); \ 264 {
return (a->
data[0] & 0xf0) == 0xe0; }
270 a->
as_u32 = clib_host_to_net_u32 ((0xe << 28) + g);
293 u32 src0, dst0, src1, dst1;
sll srl srl sll sra u16x4 i
static int ip4_header_bytes(ip4_header_t *i)
static void ip4_tcp_reply_x1(ip4_header_t *ip0, tcp_header_t *tcp0)
static uword ip4_header_checksum_is_valid(ip4_header_t *i)
ip_csum_t ip_incremental_checksum(ip_csum_t sum, void *_data, uword n_bytes)
static uword ip4_address_netmask_length(ip4_address_t *a)
static int ip4_get_fragment_offset(ip4_header_t *i)
static void * ip4_next_header(ip4_header_t *i)
static int ip4_is_fragment(ip4_header_t *i)
static uword ip4_address_is_multicast(ip4_address_t *a)
static void ip4_tcp_reply_x2(ip4_header_t *ip0, ip4_header_t *ip1, tcp_header_t *tcp0, tcp_header_t *tcp1)
#define IP4_HEADER_FLAG_MORE_FRAGMENTS
#define clib_memcpy(a, b, c)
static int ip4_is_first_fragment(ip4_header_t *i)
static void ip4_addr_fib_init(ip4_address_fib_t *addr_fib, ip4_address_t *address, u32 fib_index)
static void ip4_multicast_address_set_for_group(ip4_address_t *a, ip_multicast_group_t g)
static int ip4_get_fragment_more(ip4_header_t *i)
static int ip4_get_fragment_offset_bytes(ip4_header_t *i)
static u16 ip4_header_checksum(ip4_header_t *i)
static u16 ip_csum_fold(ip_csum_t c)