#include <stdint.h>
#include <netinet/in.h>
#include <rte_byteorder.h>
#include <rte_mbuf.h>
Go to the source code of this file.
Detailed Description
IP-related defines
Definition in file rte_ip.h.
Macro Definition Documentation
#define IPv4 |
( |
|
a, |
|
|
|
b, |
|
|
|
c, |
|
|
|
d |
|
) |
| |
Value:((uint32_t)(((a) & 0xff) << 24) | \
(((b) & 0xff) << 16) | \
(((c) & 0xff) << 8) | \
((d) & 0xff))
Create IPv4 address
Definition at line 107 of file rte_ip.h.
#define IPV4_MAX_PKT_LEN 65535 |
Maximal IPv4 packet length (including a header)
Definition at line 113 of file rte_ip.h.
#define IPV4_HDR_IHL_MASK (0x0f) |
Internet header length mask for version_ihl field
Definition at line 116 of file rte_ip.h.
#define IPV4_IHL_MULTIPLIER (4) |
Internet header length field multiplier (IHL field specifies overall header length in number of 4-byte words)
Definition at line 121 of file rte_ip.h.
#define IPV4_ANY ((uint32_t)0x00000000) |
#define IPV4_LOOPBACK ((uint32_t)0x7f000001) |
#define IPV4_BROADCAST ((uint32_t)0xe0000000) |
#define IPV4_ALLHOSTS_GROUP ((uint32_t)0xe0000001) |
#define IPV4_ALLRTRS_GROUP ((uint32_t)0xe0000002) |
#define IPV4_MAX_LOCAL_GROUP ((uint32_t)0xe00000ff) |
#define IPV4_MIN_MCAST IPv4(224, 0, 0, 0) |
Minimal IPv4-multicast address
Definition at line 148 of file rte_ip.h.
#define IPV4_MAX_MCAST IPv4(239, 255, 255, 255) |
Maximum IPv4 multicast address
Definition at line 149 of file rte_ip.h.
check if IPv4 address is multicast
Definition at line 151 of file rte_ip.h.
Function Documentation
static uint16_t rte_raw_cksum |
( |
const void * |
buf, |
|
|
size_t |
len |
|
) |
| |
|
inlinestatic |
Process the non-complemented checksum of a buffer.
- Parameters
-
buf | Pointer to the buffer. |
len | Length of the buffer. |
- Returns
- The non-complemented checksum.
Definition at line 224 of file rte_ip.h.
static uint16_t rte_ipv4_cksum |
( |
const struct ipv4_hdr * |
ipv4_hdr | ) |
|
|
inlinestatic |
Process the IPv4 checksum of an IPv4 header.
The checksum field must be set to 0 by the caller.
- Parameters
-
ipv4_hdr | The pointer to the contiguous IPv4 header. |
- Returns
- The complemented checksum to set in the IP packet.
Definition at line 243 of file rte_ip.h.
static uint16_t rte_ipv4_phdr_cksum |
( |
const struct ipv4_hdr * |
ipv4_hdr, |
|
|
uint64_t |
ol_flags |
|
) |
| |
|
inlinestatic |
Process the pseudo-header checksum of an IPv4 header.
The checksum field must be set to 0 by the caller.
Depending on the ol_flags, the pseudo-header checksum expected by the drivers is not the same. For instance, when TSO is enabled, the IP payload length must not be included in the packet.
When ol_flags is 0, it computes the standard pseudo-header checksum.
- Parameters
-
ipv4_hdr | The pointer to the contiguous IPv4 header. |
ol_flags | The ol_flags of the associated mbuf. |
- Returns
- The non-complemented checksum to set in the L4 header.
Definition at line 269 of file rte_ip.h.
static uint16_t rte_ipv4_udptcp_cksum |
( |
const struct ipv4_hdr * |
ipv4_hdr, |
|
|
const void * |
l4_hdr |
|
) |
| |
|
inlinestatic |
Process the IPv4 UDP or TCP checksum.
The IPv4 header should not contains options. The IP and layer 4 checksum must be set to 0 in the packet by the caller.
- Parameters
-
ipv4_hdr | The pointer to the contiguous IPv4 header. |
l4_hdr | The pointer to the beginning of the L4 header. |
- Returns
- The complemented checksum to set in the IP packet.
Definition at line 307 of file rte_ip.h.
static uint16_t rte_ipv6_phdr_cksum |
( |
const struct ipv6_hdr * |
ipv6_hdr, |
|
|
uint64_t |
ol_flags |
|
) |
| |
|
inlinestatic |
Process the pseudo-header checksum of an IPv6 header.
Depending on the ol_flags, the pseudo-header checksum expected by the drivers is not the same. For instance, when TSO is enabled, the IPv6 payload length must not be included in the packet.
When ol_flags is 0, it computes the standard pseudo-header checksum.
- Parameters
-
ipv6_hdr | The pointer to the contiguous IPv6 header. |
ol_flags | The ol_flags of the associated mbuf. |
- Returns
- The non-complemented checksum to set in the L4 header.
Definition at line 355 of file rte_ip.h.
static uint16_t rte_ipv6_udptcp_cksum |
( |
const struct ipv6_hdr * |
ipv6_hdr, |
|
|
const void * |
l4_hdr |
|
) |
| |
|
inlinestatic |
Process the IPv6 UDP or TCP checksum.
The IPv4 header should not contains options. The layer 4 checksum must be set to 0 in the packet by the caller.
- Parameters
-
ipv6_hdr | The pointer to the contiguous IPv6 header. |
l4_hdr | The pointer to the beginning of the L4 header. |
- Returns
- The complemented checksum to set in the IP packet.
Definition at line 391 of file rte_ip.h.