From patchwork Thu Nov 27 16:32:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balasubramanian Manoharan X-Patchwork-Id: 41630 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 31387244C2 for ; Thu, 27 Nov 2014 16:33:05 +0000 (UTC) Received: by mail-wg0-f69.google.com with SMTP id k14sf3216405wgh.0 for ; Thu, 27 Nov 2014 08:33:04 -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=F9aeD5Ila/NCqlFWXQaTEPhtxqgcEel3/3/RnIhiLlk=; b=L7p29WaIWOsNyUB3hPlclOCT/StgiQzVWfC3bNu+ojIxbFtSZ1Gdsz1fE81s/0XLAe gUaBYnRE2ZyctjexuE6J089/+T+NJ2CeyvnW5bR6PqcSCzwtPDizlvW1+HMZqehDhCuN IS6xSw/Bi1c7HodIhjP8OYIt+C9OQAmItqOGtagPwQrR+QQbNh0KSicf34+RY7tuWeq7 kbtD/0wvvxQ7+RJbNU31VnIgFCmPhAsapsFgj2RsKVykoAOm+dwt4d7W0MPW2ckMPl9L MxTpCyqybpfbgJ5xdzOR3HwvzHASZgjJSCXc+rgOAt7nkCJ5pqlUIfwZNYtjV4Z/MD8B mvzQ== X-Gm-Message-State: ALoCoQmxrNEijhB4DwolvAXCIrVAqxsMflOUczE2O14W1UwW1WGjPxoVmpzSDn4W7zPV+jU4qQUY X-Received: by 10.112.169.101 with SMTP id ad5mr3229531lbc.1.1417105984464; Thu, 27 Nov 2014 08:33:04 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.134 with SMTP id b6ls742706laa.77.gmail; Thu, 27 Nov 2014 08:33:03 -0800 (PST) X-Received: by 10.112.205.65 with SMTP id le1mr25181106lbc.54.1417105983799; Thu, 27 Nov 2014 08:33:03 -0800 (PST) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id kz1si7730883lbc.63.2014.11.27.08.33.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 27 Nov 2014 08:33:03 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by mail-lb0-f176.google.com with SMTP id p9so4487030lbv.35 for ; Thu, 27 Nov 2014 08:33:03 -0800 (PST) X-Received: by 10.112.52.37 with SMTP id q5mr39369935lbo.32.1417105983454; Thu, 27 Nov 2014 08:33:03 -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 ew9csp822666lbc; Thu, 27 Nov 2014 08:33:02 -0800 (PST) X-Received: by 10.52.106.39 with SMTP id gr7mr17199014vdb.29.1417105982311; Thu, 27 Nov 2014 08:33:02 -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 s4si2899596vcf.35.2014.11.27.08.33.00 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 27 Nov 2014 08:33:02 -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 1Xu203-00059D-I2; Thu, 27 Nov 2014 16:32:59 +0000 Received: from mail-yk0-f173.google.com ([209.85.160.173]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Xu1zw-000590-Lm for lng-odp@lists.linaro.org; Thu, 27 Nov 2014 16:32:52 +0000 Received: by mail-yk0-f173.google.com with SMTP id 19so2304777ykq.18 for ; Thu, 27 Nov 2014 08:32:47 -0800 (PST) X-Received: by 10.236.202.14 with SMTP id c14mr24871096yho.196.1417105966118; Thu, 27 Nov 2014 08:32:46 -0800 (PST) Received: from bala-PowerEdge-T110-II.caveonetworks.com ([111.93.218.67]) by mx.google.com with ESMTPSA id j5sm3998270yhj.40.2014.11.27.08.32.44 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 27 Nov 2014 08:32:45 -0800 (PST) From: Balasubramanian Manoharan To: lng-odp@lists.linaro.org Date: Thu, 27 Nov 2014 22:02:24 +0530 Message-Id: <1417105945-28700-1-git-send-email-bala.manoharan@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Topics: patch Subject: [lng-odp] [PATCH v3 1/2] 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.217.176 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 --- 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