This patch adds TCP header description structure odph_tcphdr.
This structure is used for accessing TCP header information from the packet

Signed-off-by: Balasubramanian Manoharan <[email protected]>
---
 helper/include/odph_tcp.h | 61 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)
 create mode 100644 helper/include/odph_tcp.h

diff --git a/helper/include/odph_tcp.h b/helper/include/odph_tcp.h
new file mode 100644
index 0000000..4c5912b
--- /dev/null
+++ b/helper/include/odph_tcp.h
@@ -0,0 +1,61 @@
+/* Copyright (c) 2014, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP TCP header
+ */
+
+#ifndef ODPH_TCP_H_
+#define ODPH_TCP_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <odp_align.h>
+#include <odp_debug.h>
+#include <odp_byteorder.h>
+
+/** UDP header length */
+#define ODPH_TCPHDR_LEN 8
+
+/** TCP header */
+typedef struct ODP_PACKED {
+       uint16be_t src_port; /**< Source port */
+       uint16be_t dst_port; /**< Destinatino port */
+       uint32be_t seq_no;   /**< Sequence number */
+       uint32be_t ack_no;   /**< Acknowledgment number */
+       union {
+               uint32be_t flags_and_window;
+               struct {
+                       uint32be_t rsvd1:8;
+                       uint32be_t flags:8; /**< TCP flags as a byte */
+                       uint32be_t rsvd2:16;
+               };
+               struct {
+                       uint32be_t hl:4;    /**< Hdr len, in words */
+                       uint32be_t rsvd3:6; /**< Reserved */
+                       uint32be_t urg:1;   /**< ACK */
+                       uint32be_t ack:1;
+                       uint32be_t psh:1;
+                       uint32be_t rst:1;
+                       uint32be_t syn:1;
+                       uint32be_t fin:1;
+                       uint32be_t window:16; /**< Window size */
+               };
+       };
+       uint16be_t cksm;   /**< Checksum */
+       uint16be_t urgptr; /**< Urgent pointer */
+} odph_tcphdr_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
-- 
2.0.1.472.g6f92e5f


_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to