]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | iSCSI Tcp4 IO related definitions.\r | |
3 | \r | |
4 | Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>\r | |
5 | This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #ifndef _ISCSI_TCP4_IO_H_\r | |
16 | #define _ISCSI_TCP4_IO_H_\r | |
17 | \r | |
18 | #include <Library/NetLib.h>\r | |
19 | #include <Protocol/Tcp4.h>\r | |
20 | \r | |
21 | typedef struct _TCP4_IO_CONFIG_DATA {\r | |
22 | EFI_IPv4_ADDRESS LocalIp;\r | |
23 | EFI_IPv4_ADDRESS SubnetMask;\r | |
24 | EFI_IPv4_ADDRESS Gateway;\r | |
25 | \r | |
26 | EFI_IPv4_ADDRESS RemoteIp;\r | |
27 | UINT16 RemotePort;\r | |
28 | } TCP4_IO_CONFIG_DATA;\r | |
29 | \r | |
30 | typedef struct _TCP4_IO {\r | |
31 | EFI_HANDLE Image;\r | |
32 | EFI_HANDLE Controller;\r | |
33 | \r | |
34 | EFI_HANDLE Handle;\r | |
35 | EFI_TCP4_PROTOCOL *Tcp4;\r | |
36 | \r | |
37 | EFI_TCP4_CONNECTION_TOKEN ConnToken;\r | |
38 | EFI_TCP4_IO_TOKEN TxToken;\r | |
39 | EFI_TCP4_IO_TOKEN RxToken;\r | |
40 | EFI_TCP4_CLOSE_TOKEN CloseToken;\r | |
41 | \r | |
42 | BOOLEAN IsConnDone;\r | |
43 | BOOLEAN IsTxDone;\r | |
44 | BOOLEAN IsRxDone;\r | |
45 | BOOLEAN IsCloseDone;\r | |
46 | } TCP4_IO;\r | |
47 | \r | |
48 | /**\r | |
49 | Create a TCP socket with the specified configuration data. \r | |
50 | \r | |
51 | @param[in] Image The handle of the driver image.\r | |
52 | @param[in] Controller The handle of the controller.\r | |
53 | @param[in] ConfigData The Tcp4 configuration data.\r | |
54 | @param[in] Tcp4Io The Tcp4Io.\r | |
55 | \r | |
56 | @retval EFI_SUCCESS The TCP socket is created and configured.\r | |
57 | @retval Others Failed to create the TCP socket or configure it.\r | |
58 | **/\r | |
59 | EFI_STATUS\r | |
60 | Tcp4IoCreateSocket (\r | |
61 | IN EFI_HANDLE Image,\r | |
62 | IN EFI_HANDLE Controller,\r | |
63 | IN TCP4_IO_CONFIG_DATA *ConfigData,\r | |
64 | IN TCP4_IO *Tcp4Io\r | |
65 | );\r | |
66 | \r | |
67 | /**\r | |
68 | Destroy the socket. \r | |
69 | \r | |
70 | @param[in] Tcp4Io The Tcp4Io which wraps the socket to be destroyeds.\r | |
71 | **/\r | |
72 | VOID\r | |
73 | Tcp4IoDestroySocket (\r | |
74 | IN TCP4_IO *Tcp4Io\r | |
75 | );\r | |
76 | \r | |
77 | /**\r | |
78 | Connect to the other endpoint of the TCP socket.\r | |
79 | \r | |
80 | @param[in, out] Tcp4Io The Tcp4Io wrapping the TCP socket.\r | |
81 | @param[in] Timeout The time to wait for connection done.\r | |
82 | \r | |
83 | @retval EFI_SUCCESS Connect to the other endpoint of the TCP socket successfully.\r | |
84 | @retval EFI_TIMEOUT Failed to connect to the other endpoint of the TCP socket in the specified time period.\r | |
85 | @retval Others Other errors as indicated.\r | |
86 | **/\r | |
87 | EFI_STATUS\r | |
88 | Tcp4IoConnect (\r | |
89 | IN OUT TCP4_IO *Tcp4Io,\r | |
90 | IN EFI_EVENT Timeout\r | |
91 | );\r | |
92 | \r | |
93 | /**\r | |
94 | Reset the socket.\r | |
95 | \r | |
96 | @param[in, out] Tcp4Io The Tcp4Io wrapping the TCP socket.\r | |
97 | **/\r | |
98 | VOID\r | |
99 | Tcp4IoReset (\r | |
100 | IN OUT TCP4_IO *Tcp4Io\r | |
101 | );\r | |
102 | \r | |
103 | /**\r | |
104 | Transmit the Packet to the other endpoint of the socket.\r | |
105 | \r | |
106 | @param[in] Tcp4Io The Tcp4Io wrapping the TCP socket.\r | |
107 | @param[in] Packet The packet to transmit.\r | |
108 | \r | |
109 | @retval EFI_SUCCESS The packet is trasmitted.\r | |
110 | @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r | |
111 | @retval Others Other errors as indicated.\r | |
112 | **/\r | |
113 | EFI_STATUS\r | |
114 | Tcp4IoTransmit (\r | |
115 | IN TCP4_IO *Tcp4Io,\r | |
116 | IN NET_BUF *Packet\r | |
117 | );\r | |
118 | \r | |
119 | /**\r | |
120 | Receive data from the socket.\r | |
121 | \r | |
122 | @param[in] Tcp4Io The Tcp4Io which wraps the socket to be destroyed.\r | |
123 | @param[in] Packet The buffer to hold the data copy from the soket rx buffer.\r | |
124 | @param[in] AsyncMode Is this receive asyncronous or not.\r | |
125 | @param[in] Timeout The time to wait for receiving the amount of data the Packet\r | |
126 | can hold.\r | |
127 | \r | |
128 | @retval EFI_SUCCESS The required amount of data is received from the socket.\r | |
129 | @retval EFI_OUT_OF_RESOURCES Failed to allocate momery.\r | |
130 | @retval EFI_TIMEOUT Failed to receive the required amount of data in the\r | |
131 | specified time period.\r | |
132 | @retval Others Other errors as indicated.\r | |
133 | **/\r | |
134 | EFI_STATUS\r | |
135 | Tcp4IoReceive (\r | |
136 | IN TCP4_IO *Tcp4Io,\r | |
137 | IN NET_BUF *Packet,\r | |
138 | IN BOOLEAN AsyncMode,\r | |
139 | IN EFI_EVENT Timeout\r | |
140 | );\r | |
141 | \r | |
142 | #endif\r |