VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/TcpDxe/TcpOption.h@ 80721

Last change on this file since 80721 was 80721, checked in by vboxsync, 5 years ago

Devices/EFI/FirmwareNew: Start upgrade process to edk2-stable201908 (compiles on Windows and works to some extent), bugref:4643

  • Property svn:eol-style set to native
File size: 3.5 KB
Line 
1/** @file
2 Tcp option's routine header file.
3
4 Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
5
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8**/
9
10#ifndef _TCP_OPTION_H_
11#define _TCP_OPTION_H_
12
13//
14// Supported TCP option types and their length.
15//
16#define TCP_OPTION_EOP 0 ///< End Of oPtion
17#define TCP_OPTION_NOP 1 ///< No-Option.
18#define TCP_OPTION_MSS 2 ///< Maximum Segment Size
19#define TCP_OPTION_WS 3 ///< Window scale
20#define TCP_OPTION_TS 8 ///< Timestamp
21#define TCP_OPTION_MSS_LEN 4 ///< Length of MSS option
22#define TCP_OPTION_WS_LEN 3 ///< Length of window scale option
23#define TCP_OPTION_TS_LEN 10 ///< Length of timestamp option
24#define TCP_OPTION_WS_ALIGNED_LEN 4 ///< Length of window scale option, aligned
25#define TCP_OPTION_TS_ALIGNED_LEN 12 ///< Length of timestamp option, aligned
26
27//
28// recommend format of timestamp window scale
29// option for fast process.
30//
31#define TCP_OPTION_TS_FAST ((TCP_OPTION_NOP << 24) | \
32 (TCP_OPTION_NOP << 16) | \
33 (TCP_OPTION_TS << 8) | \
34 (TCP_OPTION_TS_LEN))
35
36#define TCP_OPTION_WS_FAST ((TCP_OPTION_NOP << 24) | \
37 (TCP_OPTION_WS << 16) | \
38 (TCP_OPTION_WS_LEN << 8))
39
40#define TCP_OPTION_MSS_FAST ((TCP_OPTION_MSS << 24) | (TCP_OPTION_MSS_LEN << 16))
41
42//
43// Other misc definations
44//
45#define TCP_OPTION_RCVD_MSS 0x01
46#define TCP_OPTION_RCVD_WS 0x02
47#define TCP_OPTION_RCVD_TS 0x04
48#define TCP_OPTION_MAX_WS 14 ///< Maxium window scale value
49#define TCP_OPTION_MAX_WIN 0xffff ///< Max window size in TCP header
50
51///
52/// The structure to store the parse option value.
53/// ParseOption only parses the options, doesn't process them.
54///
55typedef struct _TCP_OPTION {
56 UINT8 Flag; ///< Flag such as TCP_OPTION_RCVD_MSS
57 UINT8 WndScale; ///< The WndScale received
58 UINT16 Mss; ///< The Mss received
59 UINT32 TSVal; ///< The TSVal field in a timestamp option
60 UINT32 TSEcr; ///< The TSEcr field in a timestamp option
61} TCP_OPTION;
62
63/**
64 Compute the window scale value according to the given buffer size.
65
66 @param[in] Tcb Pointer to the TCP_CB of this TCP instance.
67
68 @return The scale value.
69
70**/
71UINT8
72TcpComputeScale (
73 IN TCP_CB *Tcb
74 );
75
76/**
77 Build the TCP option in three-way handshake.
78
79 @param[in] Tcb Pointer to the TCP_CB of this TCP instance.
80 @param[in] Nbuf Pointer to the buffer to store the options.
81
82 @return The total length of the TCP option field.
83
84**/
85UINT16
86TcpSynBuildOption (
87 IN TCP_CB *Tcb,
88 IN NET_BUF *Nbuf
89 );
90
91/**
92 Build the TCP option in synchronized states.
93
94 @param[in] Tcb Pointer to the TCP_CB of this TCP instance.
95 @param[in] Nbuf Pointer to the buffer to store the options.
96
97 @return The total length of the TCP option field.
98
99**/
100UINT16
101TcpBuildOption (
102 IN TCP_CB *Tcb,
103 IN NET_BUF *Nbuf
104 );
105
106/**
107 Parse the supported options.
108
109 @param[in] Tcp Pointer to the TCP_CB of this TCP instance.
110 @param[in, out] Option Pointer to the TCP_OPTION used to store the
111 successfully pasrsed options.
112
113 @retval 0 The options successfully pasrsed.
114 @retval -1 Ilegal option was found.
115
116**/
117INTN
118TcpParseOption (
119 IN TCP_HEAD *Tcp,
120 IN OUT TCP_OPTION *Option
121 );
122
123#endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette