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