0.01.00
tcp.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016, The OpenThread Authors.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * 3. Neither the name of the copyright holder nor the
13  * names of its contributors may be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  * POSSIBILITY OF SUCH DAMAGE.
27  */
28 
34 #ifndef TCP_HPP_
35 #define TCP_HPP_
36 
37 #include "openthread-core-config.h"
38 
39 #include <openthread/openthread.h>
40 
41 #include "net/ip6_headers.hpp"
42 
43 namespace ot {
44 namespace Ip6 {
45 
58 {
59  uint16_t mSource;
60  uint16_t mDestination;
61  uint32_t mSequenceNumber;
62  uint32_t mAckNumber;
63  uint16_t mFlags;
64  uint16_t mWindow;
65  uint16_t mChecksum;
66  uint16_t mUrgentPointer;
68 
74 class TcpHeader: private TcpHeaderPoD
75 {
76 public:
83  uint16_t GetSourcePort(void) const { return HostSwap16(mSource); }
84 
91  uint16_t GetDestinationPort(void) const { return HostSwap16(mDestination); }
92 
99  uint32_t GetSequenceNumber(void) const { return HostSwap32(mSequenceNumber); }
100 
107  uint32_t GetAcknowledgmentNumber(void) const { return HostSwap32(mAckNumber); }
108 
115  uint16_t GetFlags(void) const { return HostSwap16(mFlags); }
116 
123  uint16_t GetWindow(void) const { return HostSwap16(mWindow); }
124 
131  uint16_t GetChecksum(void) const { return HostSwap16(mChecksum); }
132 
139  uint16_t GetUrgentPointer(void) const { return HostSwap16(mUrgentPointer); }
140 
142 
148 } // namespace Ip6
149 } // namespace ot
150 
151 #endif // TCP_HPP_
Definition: cli.cpp:90
uint32_t GetAcknowledgmentNumber(void) const
This method returns the TCP Acknowledgment Sequence Number.
Definition: tcp.hpp:107
This class implements TCP header parsing.
Definition: tcp.hpp:74
uint16_t GetUrgentPointer(void) const
This method returns the TCP Urgent Pointer.
Definition: tcp.hpp:139
uint16_t GetDestinationPort(void) const
This method returns the TCP Destination Port.
Definition: tcp.hpp:91
#define OT_TOOL_PACKED_BEGIN
Compiler-specific indication that a class or struct must be byte packed.
Definition: toolchain.h:170
Definition: tcp.hpp:57
uint16_t GetSourcePort(void) const
This method returns the TCP Source Port.
Definition: tcp.hpp:83
This file defines the top-level functions for the OpenThread library.
#define OT_TOOL_PACKED_END
Compiler-specific indication at the end of a byte packed class or struct.
Definition: toolchain.h:172
uint16_t GetFlags(void) const
This method returns the TCP Flags.
Definition: tcp.hpp:115
uint32_t GetSequenceNumber(void) const
This method returns the TCP Sequence Number.
Definition: tcp.hpp:99
uint16_t GetChecksum(void) const
This method returns the TCP Checksum.
Definition: tcp.hpp:131
This file includes definitions for IPv6 packet processing.
uint16_t GetWindow(void) const
This method returns the TCP Window.
Definition: tcp.hpp:123
This file includes compile-time configuration constants for OpenThread.