aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorCarl Wallen <carl.wallen@linaro.org>2014-02-17 14:14:36 +0200
committerMaxim Uvarov <maxim.uvarov@linaro.org>2014-02-18 12:57:05 +0400
commit2d4ee4d9276e29a61d7f633e450f54f7741411e5 (patch)
tree113d03074b41d07a6ab2b166072ef03d799c72c4 /include
parent4c6e232ced29d461e5ec9744502dbd4aaddd7b7d (diff)
ODP helper: Add IPv6 header and defines. Add & rename IPv4 defines
Add IPv6 header and defines along with some new IPv4 defines and renames. Update code using updated definitions. Signed-off-by: Carl Wallen <carl.wallen@linaro.org>
Diffstat (limited to 'include')
-rw-r--r--include/helper/odp_ip.h43
1 files changed, 33 insertions, 10 deletions
diff --git a/include/helper/odp_ip.h b/include/helper/odp_ip.h
index d37daca1..a5eccc7b 100644
--- a/include/helper/odp_ip.h
+++ b/include/helper/odp_ip.h
@@ -22,12 +22,17 @@ extern "C" {
#include <odp_debug.h>
#include <odp_byteorder.h>
-#define ODP_IPV4 4 /**< IP version 4 */
-#define ODP_IPHDR_LEN 20 /**< Min length of IP header (no options) */
-#define ODP_IPHDR_IHL_MIN 5 /**< Minimum IHL value*/
+#define ODP_IPV4 4 /**< IP version 4 */
+#define ODP_IPV4HDR_LEN 20 /**< Min length of IP header (no options) */
+#define ODP_IPV4HDR_IHL_MIN 5 /**< Minimum IHL value*/
-#define ODP_IPHDR_VER(ver_ihl) (((ver_ihl) & 0xf0) >> 4)
-#define ODP_IPHDR_IHL(ver_ihl) ((ver_ihl) & 0x0f)
+#define ODP_IPV4HDR_VER(ver_ihl) (((ver_ihl) & 0xf0) >> 4)
+#define ODP_IPV4HDR_IHL(ver_ihl) ((ver_ihl) & 0x0f)
+#define ODP_IPV4HDR_FLAGS_DONT_FRAG(frag_offset) ((frag_offset) & 0x4000)
+#define ODP_IPV4HDR_FLAGS_MORE_FRAGS(frag_offset) ((frag_offset) & 0x2000)
+#define ODP_IPV4HDR_FRAG_OFFSET(frag_offset) ((frag_offset) & 0x1fff)
+
+#define ODP_IPV4HDR_IS_FRAGMENT(frag_offset) ((frag_offset) & 0x3fff)
typedef struct ODP_PACKED {
uint8_t ver_ihl;
@@ -42,13 +47,31 @@ typedef struct ODP_PACKED {
uint32be_t dst_addr;
} odp_ipv4hdr_t;
-ODP_ASSERT(sizeof(odp_ipv4hdr_t) == ODP_IPHDR_LEN, ODP_IPV4HDR_T__SIZE_ERROR);
+ODP_ASSERT(sizeof(odp_ipv4hdr_t) == ODP_IPV4HDR_LEN, ODP_IPV4HDR_T__SIZE_ERROR);
+
+
+#define ODP_IPV6 6
+#define ODP_IPV6HDR_LEN 40
+
+typedef struct ODP_PACKED {
+ uint32be_t ver_tc_flow;
+ uint16be_t payload_len;
+ uint8_t next_hdr;
+ uint8_t hop_limit;
+ uint8_t src_addr[16];
+ uint8_t dst_addr[16];
+} odp_ipv6hdr_t;
-/* IP header protocol ('proto') field values, a selected few */
-#define ODP_IPPROTO_ICMP 0x01 /**< Internet Control Message Protocol */
-#define ODP_IPPROTO_TCP 0x06 /**< Transmission Control Protocol */
-#define ODP_IPPROTO_UDP 0x11 /**< User Datagram Protocol */
+ODP_ASSERT(sizeof(odp_ipv6hdr_t) == ODP_IPV6HDR_LEN, ODP_IPV6HDR_T__SIZE_ERROR);
+/* IP protocol values (IPv4:'proto' or IPv6:'next_hdr') */
+#define ODP_IPPROTO_ICMP 0x01 /**< Internet Control Message Protocol (1) */
+#define ODP_IPPROTO_TCP 0x06 /**< Transmission Control Protocol (6) */
+#define ODP_IPPROTO_UDP 0x11 /**< User Datagram Protocol (17) */
+#define ODP_IPPROTO_SCTP 0x84 /**< Stream Control Transmission Protocol (132) */
+#define ODP_IPPROTO_FRAG 0x2C /**< Fragment (44) */
+#define ODP_IPPROTO_AH 0x33 /**< Authentication Header (51) */
+#define ODP_IPPROTO_ESP 0x32 /**< Encapsulating Security Payload (50) */
#ifdef __cplusplus
}