diff options
author | Balasubramanian Manoharan <bala.manoharan@linaro.org> | 2014-12-08 17:32:54 +0530 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2014-12-10 15:54:35 +0300 |
commit | 08796a4634fd40e558425752bd2352176e70f10d (patch) | |
tree | f501bdf1c71e3c5a4e9e15297b101afb1933d206 /helper | |
parent | 1c823b1ca0c6616b90d9f0adf45421a482fb3b53 (diff) |
helper: odph_tcp header description
Adds TCP header description struct odph_tcphdr_t in helper directory.
This structure is used for accessing TCP header information from the packet
Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Reviewed-by: Petri Savolainen <petri.savolainen@linaro.org>
Reviewed-by: Victor Kamensky <victor.kamensky@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'helper')
-rw-r--r-- | helper/include/odph_tcp.h | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/helper/include/odph_tcp.h b/helper/include/odph_tcp.h new file mode 100644 index 0000000..3992ecf --- /dev/null +++ b/helper/include/odph_tcp.h @@ -0,0 +1,81 @@ +/* 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> + +/** TCP header */ +typedef struct ODP_PACKED { + uint16be_t src_port; /**< Source port */ + uint16be_t dst_port; /**< Destination port */ + uint32be_t seq_no; /**< Sequence number */ + uint32be_t ack_no; /**< Acknowledgment number */ + union { + uint16be_t doffset_flags; +#if defined(ODP_BIG_ENDIAN_BITFIELD) + struct { + uint16be_t rsvd1:8; + uint16be_t flags:8; /**< TCP flags as a byte */ + }; + struct { + uint16be_t hl:4; /**< Hdr len, in words */ + uint16be_t rsvd3:4; /**< Reserved */ + uint16be_t cwr:1; + uint16be_t ece:1; + uint16be_t urg:1; + uint16be_t ack:1; + uint16be_t psh:1; + uint16be_t rst:1; + uint16be_t syn:1; + uint16be_t fin:1; + }; +#elif defined(ODP_LITTLE_ENDIAN_BITFIELD) + struct { + uint16be_t flags:8; + uint16be_t rsvd1:8; /**< TCP flags as a byte */ + }; + struct { + uint16be_t rsvd3:4; /**< Reserved */ + uint16be_t hl:4; /**< Hdr len, in words */ + uint16be_t fin:1; + uint16be_t syn:1; + uint16be_t rst:1; + uint16be_t psh:1; + uint16be_t ack:1; + uint16be_t urg:1; + uint16be_t ece:1; + uint16be_t cwr:1; + }; + +#else +#error "Endian BitField order not defined!" +#endif + }; + uint16be_t window; /**< Window size */ + uint16be_t cksm; /**< Checksum */ + uint16be_t urgptr; /**< Urgent pointer */ +} odph_tcphdr_t; + +#ifdef __cplusplus +} +#endif + +#endif |