\r
/**\r
Get the current operational status.\r
+ \r
+ The GetModeData() function copies the current operational settings of this \r
+ EFI TCPv4 Protocol instance into user-supplied buffers. This function can \r
+ also be used to retrieve the operational setting of underlying drivers \r
+ such as IPv4, MNP, or SNP.\r
\r
@param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
@param Tcp4State Pointer to the buffer to receive the current TCP\r
state.\r
@param Tcp4ConfigData Pointer to the buffer to receive the current TCP\r
configuration.\r
- @param Ip4ModeData Pointer to the buffer to receive the current\r
- IPv4 configuration.\r
+ @param Ip4ModeData Pointer to the buffer to receive the current IPv4 \r
+ configuration data used by the TCPv4 instance.\r
@param MnpConfigData Pointer to the buffer to receive the current MNP\r
configuration data indirectly used by the TCPv4\r
Instance.\r
EFI_STATUS\r
EFIAPI\r
Tcp4GetModeData (\r
- IN CONST EFI_TCP4_PROTOCOL * This,\r
- OUT EFI_TCP4_CONNECTION_STATE * Tcp4State OPTIONAL,\r
- OUT EFI_TCP4_CONFIG_DATA * Tcp4ConfigData OPTIONAL,\r
- OUT EFI_IP4_MODE_DATA * Ip4ModeData OPTIONAL,\r
- OUT EFI_MANAGED_NETWORK_CONFIG_DATA * MnpConfigData OPTIONAL,\r
- OUT EFI_SIMPLE_NETWORK_MODE * SnpModeData OPTIONAL\r
+ IN CONST EFI_TCP4_PROTOCOL *This,\r
+ OUT EFI_TCP4_CONNECTION_STATE *Tcp4State OPTIONAL,\r
+ OUT EFI_TCP4_CONFIG_DATA *Tcp4ConfigData OPTIONAL,\r
+ OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL,\r
+ OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,\r
+ OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL\r
)\r
{\r
TCP4_MODE_DATA TcpMode;\r
/**\r
Initialize or brutally reset the operational parameters for\r
this EFI TCPv4 instance.\r
+ \r
+ The Configure() function does the following:\r
+ * Initialize this EFI TCPv4 instance, i.e., initialize the communication end \r
+ setting, specify active open or passive open for an instance.\r
+ * Reset this TCPv4 instance brutally, i.e., cancel all pending asynchronous \r
+ tokens, flush transmission and receiving buffer directly without informing \r
+ the communication peer.\r
+ No other TCPv4 Protocol operation can be executed by this instance \r
+ until it is configured properly. For an active TCP4 instance, after a proper \r
+ configuration it may call Connect() to initiates the three-way handshake. \r
+ For a passive TCP4 instance, its state will transit to Tcp4StateListen after \r
+ configuration, and Accept() may be called to listen the incoming TCP connection \r
+ request. If TcpConfigData is set to NULL, the instance is reset. Resetting \r
+ process will be done brutally, the state machine will be set to Tcp4StateClosed \r
+ directly, the receive queue and transmit queue will be flushed, and no traffic is \r
+ allowed through this instance.\r
\r
@param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
@param TcpConfigData Pointer to the configure data to configure the\r
EFI_STATUS\r
EFIAPI\r
Tcp4Configure (\r
- IN EFI_TCP4_PROTOCOL * This,\r
- IN EFI_TCP4_CONFIG_DATA * TcpConfigData OPTIONAL\r
+ IN EFI_TCP4_PROTOCOL *This,\r
+ IN EFI_TCP4_CONFIG_DATA *TcpConfigData OPTIONAL\r
)\r
{\r
EFI_TCP4_OPTION *Option;\r
\r
/**\r
Add or delete routing entries.\r
+ \r
+ The Routes() function adds or deletes a route from the instance¡¯s routing table.\r
+ The most specific route is selected by comparing the SubnetAddress with the \r
+ destination IP address¡¯s arithmetical AND to the SubnetMask.\r
+ The default route is added with both SubnetAddress and SubnetMask set to 0.0.0.0. \r
+ The default route matches all destination IP addresses if there is no more specific route.\r
+ Direct route is added with GatewayAddress set to 0.0.0.0. Packets are sent to \r
+ the destination host if its address can be found in the Address Resolution Protocol (ARP) \r
+ cache or it is on the local subnet. If the instance is configured to use default \r
+ address, a direct route to the local network will be added automatically.\r
+ Each TCP instance has its own independent routing table. Instance that uses the \r
+ default IP address will have a copy of the EFI_IP4_CONFIG_PROTOCOL¡¯s routing table. \r
+ The copy will be updated automatically whenever the IP driver reconfigures its \r
+ instance. As a result, the previous modification to the instance¡¯s local copy \r
+ will be lost. The priority of checking the route table is specific with IP \r
+ implementation and every IP implementation must comply with RFC 1122.\r
\r
@param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
@param DeleteRoute If TRUE, delete the specified route from routing\r
table; if FALSE, add the specified route to\r
routing table.\r
+ DestinationAddress and SubnetMask are used as \r
+ the keywords to search route entry.\r
@param SubnetAddress The destination network.\r
@param SubnetMask The subnet mask for the destination network.\r
- @param GatewayAddress The gateway address for this route.\r
-\r
+ @param GatewayAddress The gateway address for this route. \r
+ It must be on the same subnet with the station \r
+ address unless a direct route is specified.\r
+ \r
@retval EFI_SUCCESS The operation completed successfully.\r
@retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance has not been\r
configured.\r
/**\r
Initiate a nonblocking TCP connection request for an active TCP instance.\r
\r
+ The Connect() function will initiate an active open to the remote peer configured \r
+ in current TCP instance if it is configured active. If the connection succeeds \r
+ or fails due to any error, the ConnectionToken->CompletionToken.Event will be \r
+ signaled and ConnectionToken->CompletionToken.Status will be updated accordingly. \r
+ This function can only be called for the TCP instance in Tcp4StateClosed state. \r
+ The instance will transfer into Tcp4StateSynSent if the function returns EFI_SUCCESS. \r
+ If TCP three way handshake succeeds, its state will become Tcp4StateEstablished, \r
+ otherwise, the state will return to Tcp4StateClosed.\r
+ \r
@param This Pointer to the EFI_TCP4_PROTOCOL instance\r
@param ConnectionToken Pointer to the connection token to return when\r
the TCP three way handshake finishes.\r
\r
- @retval EFI_SUCCESS The connection request is successfully\r
- initiated.\r
+ @retval EFI_SUCCESS The connection request is successfully initiated \r
+ and the state of this TCPv4 instance has \r
+ been changed to Tcp4StateSynSent.\r
@retval EFI_NOT_STARTED This EFI_TCP4_PROTOCOL instance hasn't been\r
configured.\r
@retval EFI_ACCESS_DENIED The instance is not configured as an active one\r
/**\r
Listen on the passive instance to accept an incoming connection request.\r
\r
+ The Accept() function initiates an asynchronous accept request to wait for an \r
+ incoming connection on the passive TCP instance. If a remote peer successfully \r
+ establishes a connection with this instance, a new TCP instance will be created \r
+ and its handle will be returned in ListenToken->NewChildHandle. The newly created \r
+ instance is configured by inheriting the passive instance¡¯s configuration and is \r
+ ready for use upon return. The instance is in the Tcp4StateEstablished state.\r
+ The ListenToken->CompletionToken.Event will be signaled when a new connection \r
+ is accepted, user aborts the listen or connection is reset. This function only \r
+ can be called when current TCP instance is in Tcp4StateListen state.\r
+\r
@param This Pointer to the EFI_TCP4_PROTOCOL instance\r
@param ListenToken Pointer to the listen token to return when\r
operation finishes.\r
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
@retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to finish\r
the operation.\r
- @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
+ @retval EFI_DEVICE_ERROR Any unexpected and not belonged to above category error.\r
\r
**/\r
EFI_STATUS\r
/**\r
Queues outgoing data into the transmit queue\r
\r
+ The Transmit() function queues a sending request to this TCPv4 instance along \r
+ with the user data. The status of the token is updated and the event in the token \r
+ will be signaled once the data is sent out or some error occurs.\r
+\r
@param This Pointer to the EFI_TCP4_PROTOCOL instance\r
@param Token Pointer to the completion token to queue to the\r
transmit queue\r
@retval EFI_INVALID_PARAMETER One or more parameters are invalid\r
@retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:\r
* A transmit completion token with the same\r
- Token-> CompletionToken.Event was already in the\r
- transmission queue. * The current instance is in\r
- Tcp4StateClosed state * The current instance is\r
- a passive one and it is in Tcp4StateListen\r
- state. * User has called Close() to disconnect\r
- this connection.\r
+ Token-> CompletionToken.Event was already in the\r
+ transmission queue. \r
+ * The current instance is in Tcp4StateClosed state \r
+ * The current instance is a passive one and \r
+ it is in Tcp4StateListen state. \r
+ * User has called Close() to disconnect this \r
+ connection.\r
@retval EFI_NOT_READY The completion token could not be queued because\r
the transmit queue is full.\r
@retval EFI_OUT_OF_RESOURCES Could not queue the transmit data because of\r
/**\r
Place an asynchronous receive request into the receiving queue.\r
\r
+ The Receive() function places a completion token into the receive packet queue. \r
+ This function is always asynchronous. The caller must allocate the \r
+ Token->CompletionToken.Event and the FragmentBuffer used to receive data. He also \r
+ must fill the DataLength which represents the whole length of all FragmentBuffer. \r
+ When the receive operation completes, the EFI TCPv4 Protocol driver updates the \r
+ Token->CompletionToken.Status and Token->Packet.RxData fields and the \r
+ Token->CompletionToken.Event is signaled. If got data the data and its length \r
+ will be copy into the FragmentTable, in the same time the full length of received \r
+ data will be recorded in the DataLength fields. Providing a proper notification \r
+ function and context for the event will enable the user to receive the notification \r
+ and receiving status. That notification function is guaranteed to not be re-entered.\r
+\r
@param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
@param Token Pointer to a token that is associated with the\r
receive data descriptor.\r
@retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued\r
due to a lack of system resources.\r
@retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
+ The EFI TCPv4 Protocol instance has been reset \r
+ to startup defaults.\r
@retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:\r
* A receive completion token with the same\r
- Token->CompletionToken.Event was already in the\r
- receive queue. * The current instance is in\r
- Tcp4StateClosed state. * The current instance is\r
- a passive one and it is in Tcp4StateListen\r
- state. * User has called Close() to disconnect\r
- this connection.\r
+ Token->CompletionToken.Event was already in \r
+ the receive queue. \r
+ * The current instance is in Tcp4StateClosed state. \r
+ * The current instance is a passive one and it \r
+ is in Tcp4StateListen state. \r
+ * User has called Close() to disconnect this \r
+ connection.\r
@retval EFI_CONNECTION_FIN The communication peer has closed the connection\r
and there is no any buffered data in the receive\r
buffer of this instance.\r
/**\r
Disconnecting a TCP connection gracefully or reset a TCP connection.\r
\r
+ Initiate an asynchronous close token to TCP driver. After Close() is called, \r
+ any buffered transmission data will be sent by TCP driver and the current \r
+ instance will have a graceful close working flow described as RFC 793 if \r
+ AbortOnClose is set to FALSE, otherwise, a rest packet will be sent by TCP \r
+ driver to fast disconnect this connection. When the close operation completes \r
+ successfully the TCP instance is in Tcp4StateClosed state, all pending \r
+ asynchronous operation is signaled and any buffers used for TCP network traffic \r
+ is flushed.\r
+\r
@param This Pointer to the EFI_TCP4_PROTOCOL instance\r
@param CloseToken Pointer to the close token to return when\r
operation finishes.\r
@retval EFI_SUCCESS The operation completed successfully\r
@retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been\r
configured.\r
- @retval EFI_ACCESS_DENIED One or more of the following are TRUE: *\r
- Configure() has been called with TcpConfigData\r
- set to NULL and this function has not returned.\r
+ @retval EFI_ACCESS_DENIED One or more of the following are TRUE: \r
+ * Configure() has been called with TcpConfigData\r
+ set to NULL and this function has not returned.\r
* Previous Close() call on this instance has not\r
- finished.\r
+ finished.\r
@retval EFI_INVALID_PARAMETER One ore more parameters are invalid\r
@retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the\r
operation\r
/**\r
Abort an asynchronous connection, listen, transmission or receive request.\r
\r
+ The Cancel() function aborts a pending connection, listen, transmit or receive \r
+ request. If Token is not NULL and the token is in the connection, listen, \r
+ transmission or receive queue when it is being cancelled, its Token->Status \r
+ will be set to EFI_ABORTED and then Token->Event will be signaled. If the token \r
+ is not in one of the queues, which usually means that the asynchronous operation \r
+ has completed, EFI_NOT_FOUND is returned. If Token is NULL all asynchronous token \r
+ issued by Connect(), Accept(), Transmit() and Receive()will be aborted.\r
+\r
@param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
@param Token Pointer to a token that has been issued by\r
Connect(), Accept(), Transmit() or Receive(). If\r
NULL, all pending tokens issued by above four\r
functions will be aborted.\r
-\r
- @retval EFI_UNSUPPORTED The operation is not supported in current\r
+ \r
+ @retval EFI_SUCCESS The asynchronous I/O request is aborted and Token->Event\r
+ is signaled.\r
+ @retval EFI_INVALID_PARAMETER This is NULL.\r
+ @retval EFI_NOT_STARTED This instance hasn¡¯t been configured.\r
+ @retval EFI_NO_MAPPING When using the default address, configuration\r
+ (DHCP, BOOTP,RARP, etc.) hasn¡¯t finished yet.\r
+ @retval EFI_NOT_FOUND The asynchronous I/O request isn¡¯t found in the \r
+ transmission or receive queue. It has either \r
+ completed or wasn¡¯t issued by Transmit() and Receive().\r
+ @retval EFI_UNSUPPORTED The operation is not supported in current\r
implementation.\r
\r
**/\r
EFI_STATUS\r
EFIAPI\r
Tcp4Cancel (\r
- IN EFI_TCP4_PROTOCOL * This,\r
- IN EFI_TCP4_COMPLETION_TOKEN * Token OPTIONAL\r
+ IN EFI_TCP4_PROTOCOL *This,\r
+ IN EFI_TCP4_COMPLETION_TOKEN *Token OPTIONAL\r
)\r
{\r
return EFI_UNSUPPORTED;\r
/**\r
Poll to receive incoming data and transmit outgoing segments.\r
\r
+ The Poll() function increases the rate that data is moved between the network \r
+ and application and can be called when the TCP instance is created successfully. \r
+ Its use is optional. In some implementations, the periodical timer in the MNP \r
+ driver may not poll the underlying communications device fast enough to avoid \r
+ drop packets. Drivers and applications that are experiencing packet loss should \r
+ try calling the Poll() function in a high frequency.\r
+\r
@param This Pointer to the EFI_TCP4_PROTOCOL instance.\r
\r
@retval EFI_SUCCESS Incoming or outgoing data was processed.\r