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