You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Tcp4.h 25KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. /** @file
  2. EFI TCPv4(Transmission Control Protocol version 4) Protocol Definition
  3. The EFI TCPv4 Service Binding Protocol is used to locate EFI TCPv4 Protocol drivers to create
  4. and destroy child of the driver to communicate with other host using TCP protocol.
  5. The EFI TCPv4 Protocol provides services to send and receive data stream.
  6. Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
  7. This program and the accompanying materials are licensed and made available under
  8. the terms and conditions of the BSD License that accompanies this distribution.
  9. The full text of the license may be found at
  10. http://opensource.org/licenses/bsd-license.php.
  11. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  12. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
  13. @par Revision Reference:
  14. This Protocol is introduced in UEFI Specification 2.0.
  15. **/
  16. #ifndef __EFI_TCP4_PROTOCOL_H__
  17. #define __EFI_TCP4_PROTOCOL_H__
  18. FILE_LICENCE ( BSD3 );
  19. #include <ipxe/efi/Protocol/Ip4.h>
  20. #define EFI_TCP4_SERVICE_BINDING_PROTOCOL_GUID \
  21. { \
  22. 0x00720665, 0x67EB, 0x4a99, {0xBA, 0xF7, 0xD3, 0xC3, 0x3A, 0x1C, 0x7C, 0xC9 } \
  23. }
  24. #define EFI_TCP4_PROTOCOL_GUID \
  25. { \
  26. 0x65530BC7, 0xA359, 0x410f, {0xB0, 0x10, 0x5A, 0xAD, 0xC7, 0xEC, 0x2B, 0x62 } \
  27. }
  28. typedef struct _EFI_TCP4_PROTOCOL EFI_TCP4_PROTOCOL;
  29. ///
  30. /// EFI_TCP4_SERVICE_POINT is deprecated in the UEFI 2.4B and should not be used any more.
  31. /// The definition in here is only present to provide backwards compatability.
  32. ///
  33. typedef struct {
  34. EFI_HANDLE InstanceHandle;
  35. EFI_IPv4_ADDRESS LocalAddress;
  36. UINT16 LocalPort;
  37. EFI_IPv4_ADDRESS RemoteAddress;
  38. UINT16 RemotePort;
  39. } EFI_TCP4_SERVICE_POINT;
  40. ///
  41. /// EFI_TCP4_VARIABLE_DATA is deprecated in the UEFI 2.4B and should not be used any more.
  42. /// The definition in here is only present to provide backwards compatability.
  43. ///
  44. typedef struct {
  45. EFI_HANDLE DriverHandle;
  46. UINT32 ServiceCount;
  47. EFI_TCP4_SERVICE_POINT Services[1];
  48. } EFI_TCP4_VARIABLE_DATA;
  49. typedef struct {
  50. BOOLEAN UseDefaultAddress;
  51. EFI_IPv4_ADDRESS StationAddress;
  52. EFI_IPv4_ADDRESS SubnetMask;
  53. UINT16 StationPort;
  54. EFI_IPv4_ADDRESS RemoteAddress;
  55. UINT16 RemotePort;
  56. BOOLEAN ActiveFlag;
  57. } EFI_TCP4_ACCESS_POINT;
  58. typedef struct {
  59. UINT32 ReceiveBufferSize;
  60. UINT32 SendBufferSize;
  61. UINT32 MaxSynBackLog;
  62. UINT32 ConnectionTimeout;
  63. UINT32 DataRetries;
  64. UINT32 FinTimeout;
  65. UINT32 TimeWaitTimeout;
  66. UINT32 KeepAliveProbes;
  67. UINT32 KeepAliveTime;
  68. UINT32 KeepAliveInterval;
  69. BOOLEAN EnableNagle;
  70. BOOLEAN EnableTimeStamp;
  71. BOOLEAN EnableWindowScaling;
  72. BOOLEAN EnableSelectiveAck;
  73. BOOLEAN EnablePathMtuDiscovery;
  74. } EFI_TCP4_OPTION;
  75. typedef struct {
  76. //
  77. // I/O parameters
  78. //
  79. UINT8 TypeOfService;
  80. UINT8 TimeToLive;
  81. //
  82. // Access Point
  83. //
  84. EFI_TCP4_ACCESS_POINT AccessPoint;
  85. //
  86. // TCP Control Options
  87. //
  88. EFI_TCP4_OPTION *ControlOption;
  89. } EFI_TCP4_CONFIG_DATA;
  90. ///
  91. /// TCP4 connnection state
  92. ///
  93. typedef enum {
  94. Tcp4StateClosed = 0,
  95. Tcp4StateListen = 1,
  96. Tcp4StateSynSent = 2,
  97. Tcp4StateSynReceived = 3,
  98. Tcp4StateEstablished = 4,
  99. Tcp4StateFinWait1 = 5,
  100. Tcp4StateFinWait2 = 6,
  101. Tcp4StateClosing = 7,
  102. Tcp4StateTimeWait = 8,
  103. Tcp4StateCloseWait = 9,
  104. Tcp4StateLastAck = 10
  105. } EFI_TCP4_CONNECTION_STATE;
  106. typedef struct {
  107. EFI_EVENT Event;
  108. EFI_STATUS Status;
  109. } EFI_TCP4_COMPLETION_TOKEN;
  110. typedef struct {
  111. ///
  112. /// The Status in the CompletionToken will be set to one of
  113. /// the following values if the active open succeeds or an unexpected
  114. /// error happens:
  115. /// EFI_SUCCESS: The active open succeeds and the instance's
  116. /// state is Tcp4StateEstablished.
  117. /// EFI_CONNECTION_RESET: The connect fails because the connection is reset
  118. /// either by instance itself or the communication peer.
  119. /// EFI_CONNECTION_REFUSED: The connect fails because this connection is initiated with
  120. /// an active open and the connection is refused.
  121. /// EFI_ABORTED: The active open is aborted.
  122. /// EFI_TIMEOUT: The connection establishment timer expires and
  123. /// no more specific information is available.
  124. /// EFI_NETWORK_UNREACHABLE: The active open fails because
  125. /// an ICMP network unreachable error is received.
  126. /// EFI_HOST_UNREACHABLE: The active open fails because an
  127. /// ICMP host unreachable error is received.
  128. /// EFI_PROTOCOL_UNREACHABLE: The active open fails
  129. /// because an ICMP protocol unreachable error is received.
  130. /// EFI_PORT_UNREACHABLE: The connection establishment
  131. /// timer times out and an ICMP port unreachable error is received.
  132. /// EFI_ICMP_ERROR: The connection establishment timer timeout and some other ICMP
  133. /// error is received.
  134. /// EFI_DEVICE_ERROR: An unexpected system or network error occurred.
  135. /// EFI_NO_MEDIA: There was a media error.
  136. ///
  137. EFI_TCP4_COMPLETION_TOKEN CompletionToken;
  138. } EFI_TCP4_CONNECTION_TOKEN;
  139. typedef struct {
  140. EFI_TCP4_COMPLETION_TOKEN CompletionToken;
  141. EFI_HANDLE NewChildHandle;
  142. } EFI_TCP4_LISTEN_TOKEN;
  143. typedef struct {
  144. UINT32 FragmentLength;
  145. VOID *FragmentBuffer;
  146. } EFI_TCP4_FRAGMENT_DATA;
  147. typedef struct {
  148. BOOLEAN UrgentFlag;
  149. UINT32 DataLength;
  150. UINT32 FragmentCount;
  151. EFI_TCP4_FRAGMENT_DATA FragmentTable[1];
  152. } EFI_TCP4_RECEIVE_DATA;
  153. typedef struct {
  154. BOOLEAN Push;
  155. BOOLEAN Urgent;
  156. UINT32 DataLength;
  157. UINT32 FragmentCount;
  158. EFI_TCP4_FRAGMENT_DATA FragmentTable[1];
  159. } EFI_TCP4_TRANSMIT_DATA;
  160. typedef struct {
  161. ///
  162. /// When transmission finishes or meets any unexpected error it will
  163. /// be set to one of the following values:
  164. /// EFI_SUCCESS: The receiving or transmission operation
  165. /// completes successfully.
  166. /// EFI_CONNECTION_FIN: The receiving operation fails because the communication peer
  167. /// has closed the connection and there is no more data in the
  168. /// receive buffer of the instance.
  169. /// EFI_CONNECTION_RESET: The receiving or transmission operation fails
  170. /// because this connection is reset either by instance
  171. /// itself or the communication peer.
  172. /// EFI_ABORTED: The receiving or transmission is aborted.
  173. /// EFI_TIMEOUT: The transmission timer expires and no more
  174. /// specific information is available.
  175. /// EFI_NETWORK_UNREACHABLE: The transmission fails
  176. /// because an ICMP network unreachable error is received.
  177. /// EFI_HOST_UNREACHABLE: The transmission fails because an
  178. /// ICMP host unreachable error is received.
  179. /// EFI_PROTOCOL_UNREACHABLE: The transmission fails
  180. /// because an ICMP protocol unreachable error is received.
  181. /// EFI_PORT_UNREACHABLE: The transmission fails and an
  182. /// ICMP port unreachable error is received.
  183. /// EFI_ICMP_ERROR: The transmission fails and some other
  184. /// ICMP error is received.
  185. /// EFI_DEVICE_ERROR: An unexpected system or network error occurs.
  186. /// EFI_NO_MEDIA: There was a media error.
  187. ///
  188. EFI_TCP4_COMPLETION_TOKEN CompletionToken;
  189. union {
  190. ///
  191. /// When this token is used for receiving, RxData is a pointer to EFI_TCP4_RECEIVE_DATA.
  192. ///
  193. EFI_TCP4_RECEIVE_DATA *RxData;
  194. ///
  195. /// When this token is used for transmitting, TxData is a pointer to EFI_TCP4_TRANSMIT_DATA.
  196. ///
  197. EFI_TCP4_TRANSMIT_DATA *TxData;
  198. } Packet;
  199. } EFI_TCP4_IO_TOKEN;
  200. typedef struct {
  201. EFI_TCP4_COMPLETION_TOKEN CompletionToken;
  202. BOOLEAN AbortOnClose;
  203. } EFI_TCP4_CLOSE_TOKEN;
  204. //
  205. // Interface definition for TCP4 protocol
  206. //
  207. /**
  208. Get the current operational status.
  209. @param This The pointer to the EFI_TCP4_PROTOCOL instance.
  210. @param Tcp4State The pointer to the buffer to receive the current TCP state.
  211. @param Tcp4ConfigData The pointer to the buffer to receive the current TCP configuration.
  212. @param Ip4ModeData The pointer to the buffer to receive the current IPv4 configuration
  213. data used by the TCPv4 instance.
  214. @param MnpConfigData The pointer to the buffer to receive the current MNP configuration
  215. data used indirectly by the TCPv4 instance.
  216. @param SnpModeData The pointer to the buffer to receive the current SNP configuration
  217. data used indirectly by the TCPv4 instance.
  218. @retval EFI_SUCCESS The mode data was read.
  219. @retval EFI_INVALID_PARAMETER This is NULL.
  220. @retval EFI_NOT_STARTED No configuration data is available because this instance hasn't
  221. been started.
  222. **/
  223. typedef
  224. EFI_STATUS
  225. (EFIAPI *EFI_TCP4_GET_MODE_DATA)(
  226. IN EFI_TCP4_PROTOCOL *This,
  227. OUT EFI_TCP4_CONNECTION_STATE *Tcp4State OPTIONAL,
  228. OUT EFI_TCP4_CONFIG_DATA *Tcp4ConfigData OPTIONAL,
  229. OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL,
  230. OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
  231. OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
  232. );
  233. /**
  234. Initialize or brutally reset the operational parameters for this EFI TCPv4 instance.
  235. @param This The pointer to the EFI_TCP4_PROTOCOL instance.
  236. @param Tcp4ConfigData The pointer to the configure data to configure the instance.
  237. @retval EFI_SUCCESS The operational settings are set, changed, or reset
  238. successfully.
  239. @retval EFI_INVALID_PARAMETER Some parameter is invalid.
  240. @retval EFI_NO_MAPPING When using a default address, configuration (through
  241. DHCP, BOOTP, RARP, etc.) is not finished yet.
  242. @retval EFI_ACCESS_DENIED Configuring TCP instance when it is configured without
  243. calling Configure() with NULL to reset it.
  244. @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.
  245. @retval EFI_UNSUPPORTED One or more of the control options are not supported in
  246. the implementation.
  247. @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources when
  248. executing Configure().
  249. **/
  250. typedef
  251. EFI_STATUS
  252. (EFIAPI *EFI_TCP4_CONFIGURE)(
  253. IN EFI_TCP4_PROTOCOL *This,
  254. IN EFI_TCP4_CONFIG_DATA *TcpConfigData OPTIONAL
  255. );
  256. /**
  257. Add or delete a route entry to the route table
  258. @param This The pointer to the EFI_TCP4_PROTOCOL instance.
  259. @param DeleteRoute Set it to TRUE to delete this route from the routing table. Set it to
  260. FALSE to add this route to the routing table.
  261. DestinationAddress and SubnetMask are used as the
  262. keywords to search route entry.
  263. @param SubnetAddress The destination network.
  264. @param SubnetMask The subnet mask of the destination network.
  265. @param GatewayAddress The gateway address for this route. It must be on the same
  266. subnet with the station address unless a direct route is specified.
  267. @retval EFI_SUCCESS The operation completed successfully.
  268. @retval EFI_NOT_STARTED The EFI TCPv4 Protocol instance has not been configured.
  269. @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
  270. RARP, etc.) is not finished yet.
  271. @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
  272. - This is NULL.
  273. - SubnetAddress is NULL.
  274. - SubnetMask is NULL.
  275. - GatewayAddress is NULL.
  276. - *SubnetAddress is not NULL a valid subnet address.
  277. - *SubnetMask is not a valid subnet mask.
  278. - *GatewayAddress is not a valid unicast IP address or it
  279. is not in the same subnet.
  280. @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to add the entry to the
  281. routing table.
  282. @retval EFI_NOT_FOUND This route is not in the routing table.
  283. @retval EFI_ACCESS_DENIED The route is already defined in the routing table.
  284. @retval EFI_UNSUPPORTED The TCP driver does not support this operation.
  285. **/
  286. typedef
  287. EFI_STATUS
  288. (EFIAPI *EFI_TCP4_ROUTES)(
  289. IN EFI_TCP4_PROTOCOL *This,
  290. IN BOOLEAN DeleteRoute,
  291. IN EFI_IPv4_ADDRESS *SubnetAddress,
  292. IN EFI_IPv4_ADDRESS *SubnetMask,
  293. IN EFI_IPv4_ADDRESS *GatewayAddress
  294. );
  295. /**
  296. Initiate a nonblocking TCP connection request for an active TCP instance.
  297. @param This The pointer to the EFI_TCP4_PROTOCOL instance.
  298. @param ConnectionToken The pointer to the connection token to return when the TCP three
  299. way handshake finishes.
  300. @retval EFI_SUCCESS The connection request is successfully initiated and the state
  301. of this TCPv4 instance has been changed to Tcp4StateSynSent.
  302. @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
  303. @retval EFI_ACCESS_DENIED One or more of the following conditions are TRUE:
  304. - This instance is not configured as an active one.
  305. - This instance is not in Tcp4StateClosed state.
  306. @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
  307. - This is NULL.
  308. - ConnectionToken is NULL.
  309. - ConnectionToken->CompletionToken.Event is NULL.
  310. @retval EFI_OUT_OF_RESOURCES The driver can't allocate enough resource to initiate the activ eopen.
  311. @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
  312. **/
  313. typedef
  314. EFI_STATUS
  315. (EFIAPI *EFI_TCP4_CONNECT)(
  316. IN EFI_TCP4_PROTOCOL *This,
  317. IN EFI_TCP4_CONNECTION_TOKEN *ConnectionToken
  318. );
  319. /**
  320. Listen on the passive instance to accept an incoming connection request. This is a nonblocking operation.
  321. @param This The pointer to the EFI_TCP4_PROTOCOL instance.
  322. @param ListenToken The pointer to the listen token to return when operation finishes.
  323. @retval EFI_SUCCESS The listen token has been queued successfully.
  324. @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
  325. @retval EFI_ACCESS_DENIED One or more of the following are TRUE:
  326. - This instance is not a passive instance.
  327. - This instance is not in Tcp4StateListen state.
  328. - The same listen token has already existed in the listen
  329. token queue of this TCP instance.
  330. @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
  331. - This is NULL.
  332. - ListenToken is NULL.
  333. - ListentToken->CompletionToken.Event is NULL.
  334. @retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the operation.
  335. @retval EFI_DEVICE_ERROR Any unexpected and not belonged to above category error.
  336. **/
  337. typedef
  338. EFI_STATUS
  339. (EFIAPI *EFI_TCP4_ACCEPT)(
  340. IN EFI_TCP4_PROTOCOL *This,
  341. IN EFI_TCP4_LISTEN_TOKEN *ListenToken
  342. );
  343. /**
  344. Queues outgoing data into the transmit queue.
  345. @param This The pointer to the EFI_TCP4_PROTOCOL instance.
  346. @param Token The pointer to the completion token to queue to the transmit queue.
  347. @retval EFI_SUCCESS The data has been queued for transmission.
  348. @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
  349. @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
  350. RARP, etc.) is not finished yet.
  351. @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
  352. - This is NULL.
  353. - Token is NULL.
  354. - Token->CompletionToken.Event is NULL.
  355. - Token->Packet.TxData is NULL L.
  356. - Token->Packet.FragmentCount is zero.
  357. - Token->Packet.DataLength is not equal to the sum of fragment lengths.
  358. @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:
  359. - A transmit completion token with the same Token->CompletionToken.Event
  360. was already in the transmission queue.
  361. - The current instance is in Tcp4StateClosed state.
  362. - The current instance is a passive one and it is in
  363. Tcp4StateListen state.
  364. - User has called Close() to disconnect this connection.
  365. @retval EFI_NOT_READY The completion token could not be queued because the
  366. transmit queue is full.
  367. @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data because of resource
  368. shortage.
  369. @retval EFI_NETWORK_UNREACHABLE There is no route to the destination network or address.
  370. **/
  371. typedef
  372. EFI_STATUS
  373. (EFIAPI *EFI_TCP4_TRANSMIT)(
  374. IN EFI_TCP4_PROTOCOL *This,
  375. IN EFI_TCP4_IO_TOKEN *Token
  376. );
  377. /**
  378. Places an asynchronous receive request into the receiving queue.
  379. @param This The pointer to the EFI_TCP4_PROTOCOL instance.
  380. @param Token The pointer to a token that is associated with the receive data
  381. descriptor.
  382. @retval EFI_SUCCESS The receive completion token was cached.
  383. @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
  384. @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, RARP,
  385. etc.) is not finished yet.
  386. @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
  387. - This is NULL.
  388. - Token is NULL.
  389. - Token->CompletionToken.Event is NULL.
  390. - Token->Packet.RxData is NULL.
  391. - Token->Packet.RxData->DataLength is 0.
  392. - The Token->Packet.RxData->DataLength is not
  393. the sum of all FragmentBuffer length in FragmentTable.
  394. @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of
  395. system resources (usually memory).
  396. @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
  397. @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:
  398. - A receive completion token with the same Token-
  399. >CompletionToken.Event was already in the receive
  400. queue.
  401. - The current instance is in Tcp4StateClosed state.
  402. - The current instance is a passive one and it is in
  403. Tcp4StateListen state.
  404. - User has called Close() to disconnect this connection.
  405. @retval EFI_CONNECTION_FIN The communication peer has closed the connection and there is
  406. no any buffered data in the receive buffer of this instance.
  407. @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.
  408. **/
  409. typedef
  410. EFI_STATUS
  411. (EFIAPI *EFI_TCP4_RECEIVE)(
  412. IN EFI_TCP4_PROTOCOL *This,
  413. IN EFI_TCP4_IO_TOKEN *Token
  414. );
  415. /**
  416. Disconnecting a TCP connection gracefully or reset a TCP connection. This function is a
  417. nonblocking operation.
  418. @param This The pointer to the EFI_TCP4_PROTOCOL instance.
  419. @param CloseToken The pointer to the close token to return when operation finishes.
  420. @retval EFI_SUCCESS The Close() is called successfully.
  421. @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured.
  422. @retval EFI_ACCESS_DENIED One or more of the following are TRUE:
  423. - Configure() has been called with
  424. TcpConfigData set to NULL and this function has
  425. not returned.
  426. - Previous Close() call on this instance has not
  427. finished.
  428. @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
  429. - This is NULL.
  430. - CloseToken is NULL.
  431. - CloseToken->CompletionToken.Event is NULL.
  432. @retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the operation.
  433. @retval EFI_DEVICE_ERROR Any unexpected and not belonged to above category error.
  434. **/
  435. typedef
  436. EFI_STATUS
  437. (EFIAPI *EFI_TCP4_CLOSE)(
  438. IN EFI_TCP4_PROTOCOL *This,
  439. IN EFI_TCP4_CLOSE_TOKEN *CloseToken
  440. );
  441. /**
  442. Abort an asynchronous connection, listen, transmission or receive request.
  443. @param This The pointer to the EFI_TCP4_PROTOCOL instance.
  444. @param Token The pointer to a token that has been issued by
  445. EFI_TCP4_PROTOCOL.Connect(),
  446. EFI_TCP4_PROTOCOL.Accept(),
  447. EFI_TCP4_PROTOCOL.Transmit() or
  448. EFI_TCP4_PROTOCOL.Receive(). If NULL, all pending
  449. tokens issued by above four functions will be aborted. Type
  450. EFI_TCP4_COMPLETION_TOKEN is defined in
  451. EFI_TCP4_PROTOCOL.Connect().
  452. @retval EFI_SUCCESS The asynchronous I/O request is aborted and Token->Event
  453. is signaled.
  454. @retval EFI_INVALID_PARAMETER This is NULL.
  455. @retval EFI_NOT_STARTED This instance hasn't been configured.
  456. @retval EFI_NO_MAPPING When using the default address, configuration
  457. (DHCP, BOOTP,RARP, etc.) hasn't finished yet.
  458. @retval EFI_NOT_FOUND The asynchronous I/O request isn't found in the
  459. transmission or receive queue. It has either
  460. completed or wasn't issued by Transmit() and Receive().
  461. @retval EFI_UNSUPPORTED The implementation does not support this function.
  462. **/
  463. typedef
  464. EFI_STATUS
  465. (EFIAPI *EFI_TCP4_CANCEL)(
  466. IN EFI_TCP4_PROTOCOL *This,
  467. IN EFI_TCP4_COMPLETION_TOKEN *Token OPTIONAL
  468. );
  469. /**
  470. Poll to receive incoming data and transmit outgoing segments.
  471. @param This The pointer to the EFI_TCP4_PROTOCOL instance.
  472. @retval EFI_SUCCESS Incoming or outgoing data was processed.
  473. @retval EFI_INVALID_PARAMETER This is NULL.
  474. @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
  475. @retval EFI_NOT_READY No incoming or outgoing data is processed.
  476. @retval EFI_TIMEOUT Data was dropped out of the transmission or receive queue.
  477. Consider increasing the polling rate.
  478. **/
  479. typedef
  480. EFI_STATUS
  481. (EFIAPI *EFI_TCP4_POLL)(
  482. IN EFI_TCP4_PROTOCOL *This
  483. );
  484. ///
  485. /// The EFI_TCP4_PROTOCOL defines the EFI TCPv4 Protocol child to be used by
  486. /// any network drivers or applications to send or receive data stream.
  487. /// It can either listen on a specified port as a service or actively connected
  488. /// to remote peer as a client. Each instance has its own independent settings,
  489. /// such as the routing table.
  490. ///
  491. struct _EFI_TCP4_PROTOCOL {
  492. EFI_TCP4_GET_MODE_DATA GetModeData;
  493. EFI_TCP4_CONFIGURE Configure;
  494. EFI_TCP4_ROUTES Routes;
  495. EFI_TCP4_CONNECT Connect;
  496. EFI_TCP4_ACCEPT Accept;
  497. EFI_TCP4_TRANSMIT Transmit;
  498. EFI_TCP4_RECEIVE Receive;
  499. EFI_TCP4_CLOSE Close;
  500. EFI_TCP4_CANCEL Cancel;
  501. EFI_TCP4_POLL Poll;
  502. };
  503. extern EFI_GUID gEfiTcp4ServiceBindingProtocolGuid;
  504. extern EFI_GUID gEfiTcp4ProtocolGuid;
  505. #endif