]>
Commit | Line | Data |
---|---|---|
02aa4e52 | 1 | /** @file\r |
55a64ae0 | 2 | iSCSI Tcp4 IO related definitions.\r |
6a690e23 | 3 | \r |
e5eed7d3 HT |
4 | Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>\r |
5 | This program and the accompanying materials\r | |
7a444476 | 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 | |
6a690e23 | 12 | \r |
12618416 | 13 | **/\r |
6a690e23 | 14 | \r |
15 | #ifndef _ISCSI_TCP4_IO_H_\r | |
16 | #define _ISCSI_TCP4_IO_H_\r | |
17 | \r | |
18 | #include <Library/NetLib.h>\r | |
9cb8724d | 19 | #include <Protocol/Tcp4.h>\r |
6a690e23 | 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 | |
12618416 | 48 | /**\r |
49 | Create a TCP socket with the specified configuration data. \r | |
50 | \r | |
02aa4e52 | 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 | |
12618416 | 55 | \r |
56 | @retval EFI_SUCCESS The TCP socket is created and configured.\r | |
02aa4e52 | 57 | @retval Others Failed to create the TCP socket or configure it.\r |
12618416 | 58 | **/\r |
6a690e23 | 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 | |
12618416 | 67 | /**\r |
68 | Destroy the socket. \r | |
69 | \r | |
70 | @param[in] Tcp4Io The Tcp4Io which wraps the socket to be destroyeds.\r | |
12618416 | 71 | **/\r |
6a690e23 | 72 | VOID\r |
73 | Tcp4IoDestroySocket (\r | |
74 | IN TCP4_IO *Tcp4Io\r | |
75 | );\r | |
76 | \r | |
12618416 | 77 | /**\r |
78 | Connect to the other endpoint of the TCP socket.\r | |
79 | \r | |
c5de0d55 | 80 | @param[in, out] Tcp4Io The Tcp4Io wrapping the TCP socket.\r |
81 | @param[in] Timeout The time to wait for connection done.\r | |
02aa4e52 | 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 | |
963dbb30 | 85 | @retval Others Other errors as indicated.\r |
12618416 | 86 | **/\r |
6a690e23 | 87 | EFI_STATUS\r |
88 | Tcp4IoConnect (\r | |
c5de0d55 | 89 | IN OUT TCP4_IO *Tcp4Io,\r |
90 | IN EFI_EVENT Timeout\r | |
6a690e23 | 91 | );\r |
92 | \r | |
12618416 | 93 | /**\r |
94 | Reset the socket.\r | |
95 | \r | |
c5de0d55 | 96 | @param[in, out] Tcp4Io The Tcp4Io wrapping the TCP socket.\r |
12618416 | 97 | **/\r |
6a690e23 | 98 | VOID\r |
99 | Tcp4IoReset (\r | |
c5de0d55 | 100 | IN OUT TCP4_IO *Tcp4Io\r |
6a690e23 | 101 | );\r |
102 | \r | |
12618416 | 103 | /**\r |
104 | Transmit the Packet to the other endpoint of the socket.\r | |
105 | \r | |
02aa4e52 | 106 | @param[in] Tcp4Io The Tcp4Io wrapping the TCP socket.\r |
107 | @param[in] Packet The packet to transmit.\r | |
108 | \r | |
12618416 | 109 | @retval EFI_SUCCESS The packet is trasmitted.\r |
12618416 | 110 | @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r |
963dbb30 | 111 | @retval Others Other errors as indicated.\r |
12618416 | 112 | **/\r |
6a690e23 | 113 | EFI_STATUS\r |
114 | Tcp4IoTransmit (\r | |
115 | IN TCP4_IO *Tcp4Io,\r | |
116 | IN NET_BUF *Packet\r | |
117 | );\r | |
118 | \r | |
12618416 | 119 | /**\r |
120 | Receive data from the socket.\r | |
121 | \r | |
02aa4e52 | 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 | |
12618416 | 126 | can hold.\r |
127 | \r | |
128 | @retval EFI_SUCCESS The required amount of data is received from the socket.\r | |
12618416 | 129 | @retval EFI_OUT_OF_RESOURCES Failed to allocate momery.\r |
12618416 | 130 | @retval EFI_TIMEOUT Failed to receive the required amount of data in the\r |
131 | specified time period.\r | |
963dbb30 | 132 | @retval Others Other errors as indicated.\r |
12618416 | 133 | **/\r |
6a690e23 | 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 |