]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Option.h
Sync the latest version from R8.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Tcp4Dxe / Tcp4Option.h
CommitLineData
83cbd279 1/** @file\r
2\r
3Copyright (c) 2005 - 2006, Intel Corporation\r
4All rights reserved. This program and the accompanying materials\r
5are licensed and made available under the terms and conditions of the BSD License\r
6which accompanies this distribution. The full text of the license may be found at\r
7http://opensource.org/licenses/bsd-license.php\r
8\r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11\r
12Module Name:\r
13\r
14 Tcp4Option.h\r
15\r
16Abstract:\r
17\r
18\r
19**/\r
20\r
21#ifndef _TCP4_OPTION_H_\r
22#define _TCP4_OPTION_H_\r
23\r
24//\r
25// The structure to store the parse option value.\r
26// ParseOption only parse the options, don't process them.\r
27//\r
28typedef struct s_TCP_OPTION {\r
29 UINT8 Flag; // flag such as TCP_OPTION_RCVD_MSS\r
30 UINT8 WndScale; // the WndScale received\r
31 UINT16 Mss; // the Mss received\r
32 UINT32 TSVal; // the TSVal field in a timestamp option\r
33 UINT32 TSEcr; // the TSEcr field in a timestamp option\r
34} TCP_OPTION;\r
35\r
36enum {\r
37\r
38 //\r
39 // supported TCP option type and their length\r
40 //\r
41 TCP_OPTION_EOP = 0, // End Of oPtion\r
42 TCP_OPTION_NOP = 1, // No-Option.\r
43 TCP_OPTION_MSS = 2, // Maximum Segment Size\r
44 TCP_OPTION_WS = 3, // Window scale\r
45 TCP_OPTION_TS = 8, // Timestamp\r
46 TCP_OPTION_MSS_LEN = 4, // length of MSS option\r
47 TCP_OPTION_WS_LEN = 3, // length of window scale option\r
48 TCP_OPTION_TS_LEN = 10, // length of timestamp option\r
49 TCP_OPTION_WS_ALIGNED_LEN = 4, // length of window scale option, aligned\r
50 TCP_OPTION_TS_ALIGNED_LEN = 12, // length of timestamp option, aligned\r
51\r
52 //\r
53 // recommend format of timestamp window scale\r
54 // option for fast process.\r
55 //\r
56 TCP_OPTION_TS_FAST = ((TCP_OPTION_NOP << 24) |\r
57 (TCP_OPTION_NOP << 16) |\r
58 (TCP_OPTION_TS << 8) |\r
59 TCP_OPTION_TS_LEN),\r
60\r
61 TCP_OPTION_WS_FAST = ((TCP_OPTION_NOP << 24) |\r
62 (TCP_OPTION_WS << 16) |\r
63 (TCP_OPTION_WS_LEN << 8)),\r
64\r
65 TCP_OPTION_MSS_FAST = ((TCP_OPTION_MSS << 24) |\r
66 (TCP_OPTION_MSS_LEN << 16)),\r
67\r
68 //\r
69 // Other misc definations\r
70 //\r
71 TCP_OPTION_MAX_WS = 14, // Maxium window scale value\r
72 TCP_OPTION_MAX_WIN = 0xffff, // max window size in TCP header\r
73 TCP_OPTION_RCVD_MSS = 0x01,\r
74 TCP_OPTION_RCVD_WS = 0x02,\r
75 TCP_OPTION_RCVD_TS = 0x04\r
76};\r
77\r
78UINT8\r
79TcpComputeScale (\r
80 IN TCP_CB *Tcb\r
81 );\r
82\r
83UINT16\r
84TcpSynBuildOption (\r
85 IN TCP_CB *Tcb,\r
86 IN NET_BUF *Buf\r
87 );\r
88\r
89UINT16\r
90TcpBuildOption (\r
91 IN TCP_CB *Tcb,\r
92 IN NET_BUF *Buf\r
93 );\r
94\r
95INTN\r
96TcpParseOption (\r
97 IN TCP_HEAD *Tcp,\r
98 IN TCP_OPTION *Option\r
99 );\r
100\r
101UINT32\r
102TcpPawsOK (\r
103 IN TCP_CB *Tcb,\r
104 IN UINT32 TSVal\r
105 );\r
106\r
107#endif\r