From patchwork Thu Nov 27 06:34:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balasubramanian Manoharan X-Patchwork-Id: 41604 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 564FB244C2 for ; Thu, 27 Nov 2014 06:35:03 +0000 (UTC) Received: by mail-la0-f72.google.com with SMTP id gq15sf2612930lab.11 for ; Wed, 26 Nov 2014 22:35:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:subject :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=h9AsaFyhiq4TgfvOhJTl7R6uwGo8YdAMsgUXwF5oN2s=; b=VNrI45SM96I/H4+XrJRdcMlqZPeu0NjIjKFcnzgbrWZDaRu9piL/ndYvY79qWtiwEv 9bcXD/558Em3u8M7Mm7Jp6PDg6Cat6J7Bf/DGfPBfTopUliOQNdd4QyWtEf6ItGaeuS9 DROvMt186MGm9zY6/mxHkA97t77E7E0kcIOEQilslvgDheD+A/TLxl3wjj16IBUgY326 Be4rfvC9rLNGHT4lvRl0h2A94O75EdrC9H8+wt4DhEpje5mZ1RgPgt8/nytZQfZ40eyg feAXnhunEdh4OvRcs8lmUyhzzoJtLWk7pP67eg+dk5Zx7Dc4ZsGDJzO55xb0i+dSBWsm hz1w== X-Gm-Message-State: ALoCoQn9q2JokE4MttBRYjbze2h/fVVrMqZMLHl8fuo94P7V52bfDPM45G2eoVJ23A4nzCgR9P/K X-Received: by 10.112.201.169 with SMTP id kb9mr2565lbc.20.1417070102327; Wed, 26 Nov 2014 22:35:02 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.88.77 with SMTP id be13ls379948lab.40.gmail; Wed, 26 Nov 2014 22:35:02 -0800 (PST) X-Received: by 10.112.63.70 with SMTP id e6mr36622693lbs.93.1417070102183; Wed, 26 Nov 2014 22:35:02 -0800 (PST) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com. [209.85.215.48]) by mx.google.com with ESMTPS id m7si5539881lbp.85.2014.11.26.22.35.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 26 Nov 2014 22:35:02 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by mail-la0-f48.google.com with SMTP id s18so3746849lam.35 for ; Wed, 26 Nov 2014 22:35:02 -0800 (PST) X-Received: by 10.152.37.69 with SMTP id w5mr36829966laj.67.1417070102096; Wed, 26 Nov 2014 22:35:02 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp753024lbc; Wed, 26 Nov 2014 22:35:01 -0800 (PST) X-Received: by 10.221.20.74 with SMTP id qn10mr19573394vcb.50.1417070100661; Wed, 26 Nov 2014 22:35:00 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id ig9si1600737vdb.49.2014.11.26.22.34.59 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 26 Nov 2014 22:35:00 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XtsfJ-0003fn-Gi; Thu, 27 Nov 2014 06:34:57 +0000 Received: from mail-yh0-f51.google.com ([209.85.213.51]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XtsfC-0003fi-SM for lng-odp@lists.linaro.org; Thu, 27 Nov 2014 06:34:50 +0000 Received: by mail-yh0-f51.google.com with SMTP id a41so1993848yho.24 for ; Wed, 26 Nov 2014 22:34:45 -0800 (PST) X-Received: by 10.236.10.45 with SMTP id 33mr35833026yhu.154.1417070085661; Wed, 26 Nov 2014 22:34:45 -0800 (PST) Received: from bala-PowerEdge-T110-II.caveonetworks.com ([111.93.218.67]) by mx.google.com with ESMTPSA id d4sm3417936yhd.43.2014.11.26.22.34.43 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 26 Nov 2014 22:34:45 -0800 (PST) From: Balasubramanian Manoharan To: lng-odp@lists.linaro.org Date: Thu, 27 Nov 2014 12:04:25 +0530 Message-Id: <1417070065-27696-1-git-send-email-bala.manoharan@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Topics: patch Subject: [lng-odp] [PATCH v2] helper: odph_tcp header description X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: bala.manoharan@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 This patch adds TCP header description struct odph_tcphdr_t This structure is used for accessing TCP header information from the packet Signed-off-by: Balasubramanian Manoharan --- V2: Removes Bit Fields from Header struct helper/include/odph_tcp.h | 90 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 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..f625ac7 --- /dev/null +++ b/helper/include/odph_tcp.h @@ -0,0 +1,90 @@ +/* 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 +#include +#include + +/** @internal TCP header flag FIN offset */ +#define ODPH_TCPHDR_FIN_OFFSET 0 + +/** @internal TCP header flag SYN offset */ +#define ODPH_TCPHDR_SYN_OFFSET 1 + +/** @internal TCP header flag RST offset */ +#define ODPH_TCPHDR_RST_OFFSET 2 + +/** @internal TCP header flag PSH offset */ +#define ODPH_TCPHDR_PSH_OFFSET 3 + +/** @internal TCP header flag ACK offset */ +#define ODPH_TCPHDR_ACK_OFFSET 4 + +/** @internal TCP header flag URG offset */ +#define ODPH_TCPHDR_URG_OFFSET 5 + +/** @internal TCP header flag ECE offset */ +#define ODPH_TCPHDR_ECE_OFFSET 6 + +/** @internal TCP header flag CWR offset */ +#define ODPH_TCPHDR_CWR_OFFSET 7 + +/** @internal Returns TCP header FIN flag */ +#define ODPH_TCPHDR_FLAGS_FIN(flags) ((flags) & (1 << ODPH_TCPHDR_FIN_OFFSET)) + +/** @internal Returns TCP header SYN flag */ +#define ODPH_TCPHDR_FLAGS_SYN(flags) ((flags) & (1 << ODPH_TCPHDR_SYN_OFFSET)) + +/** @internal Returns TCP header RST flag */ +#define ODPH_TCPHDR_FLAGS_RST(flags) ((flags) & (1 << ODPH_TCPHDR_RST_OFFSET)) + +/** @internal Returns TCP header PSH flag */ +#define ODPH_TCPHDR_FLAGS_PSH(flags) ((flags) & (1 << ODPH_TCPHDR_PSH_OFFSET)) + +/** @internal Returns TCP header ACK flag */ +#define ODPH_TCPHDR_FLAGS_ACK(flags) ((flags) & (1 << ODPH_TCPHDR_ACK_OFFSET)) + +/** @internal Returns TCP header URG flag */ +#define ODPH_TCPHDR_FLAGS_URG(flags) ((flags) & (1 << ODPH_TCPHDR_URG_OFFSET)) + +/** @internal Returns TCP header ECE flag */ +#define ODPH_TCPHDR_FLAGS_ECE(flags) ((flags) & (1 << ODPH_TCPHDR_ECE_OFFSET)) + +/** @internal Returns TCP header CWR flag */ +#define ODPH_TCPHDR_FLAGS_CWR(flags) ((flags) & (1 << ODPH_TCPHDR_CWR_OFFSET)) + +/** 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 */ + uint8_t data_offset; /**< Data offset and reserved */ + uint8_t flags; /**< TCP flags as a byte */ + uint16be_t window; /**< Window size */ + uint16be_t cksm; /**< Checksum */ + uint16be_t urgptr; /**< Urgent pointer */ +} odph_tcphdr_t; + +#ifdef __cplusplus +} +#endif + +#endif