TianoCore EDK2 master
Loading...
Searching...
No Matches
TcpIoLib.h File Reference
#include <Protocol/Tcp4.h>
#include <Protocol/Tcp6.h>
#include <Library/NetLib.h>

Go to the source code of this file.

Data Structures

struct  TCP4_IO_CONFIG_DATA
 
struct  TCP6_IO_CONFIG_DATA
 
union  TCP_IO_CONFIG_DATA
 
union  TCP_IO_PROTOCOL
 
union  TCP_IO_CONNECTION_TOKEN
 
union  TCP_IO_IO_TOKEN
 
union  TCP_IO_CLOSE_TOKEN
 
union  TCP_IO_LISTEN_TOKEN
 
struct  TCP_IO
 

Macros

#define TCP_VERSION_4   IP_VERSION_4
 
#define TCP_VERSION_6   IP_VERSION_6
 
#define TCP_GET_MAPPING_TIMEOUT   100000000U
 

Functions

EFI_STATUS EFIAPI TcpIoCreateSocket (IN EFI_HANDLE Image, IN EFI_HANDLE Controller, IN UINT8 TcpVersion, IN TCP_IO_CONFIG_DATA *ConfigData, OUT TCP_IO *TcpIo)
 
VOID EFIAPI TcpIoDestroySocket (IN TCP_IO *TcpIo)
 
EFI_STATUS EFIAPI TcpIoConnect (IN OUT TCP_IO *TcpIo, IN EFI_EVENT Timeout OPTIONAL)
 
EFI_STATUS EFIAPI TcpIoAccept (IN OUT TCP_IO *TcpIo, IN EFI_EVENT Timeout OPTIONAL)
 
VOID EFIAPI TcpIoReset (IN OUT TCP_IO *TcpIo)
 
EFI_STATUS EFIAPI TcpIoTransmit (IN TCP_IO *TcpIo, IN NET_BUF *Packet)
 
EFI_STATUS EFIAPI TcpIoReceive (IN OUT TCP_IO *TcpIo, IN NET_BUF *Packet, IN BOOLEAN AsyncMode, IN EFI_EVENT Timeout OPTIONAL)
 

Detailed Description

This library is used to share code between UEFI network stack modules. It provides the helper routines to access TCP service.

Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file TcpIoLib.h.

Macro Definition Documentation

◆ TCP_GET_MAPPING_TIMEOUT

#define TCP_GET_MAPPING_TIMEOUT   100000000U

10 seconds

Definition at line 24 of file TcpIoLib.h.

◆ TCP_VERSION_4

#define TCP_VERSION_4   IP_VERSION_4

Definition at line 18 of file TcpIoLib.h.

◆ TCP_VERSION_6

#define TCP_VERSION_6   IP_VERSION_6

Definition at line 19 of file TcpIoLib.h.

Function Documentation

◆ TcpIoAccept()

EFI_STATUS EFIAPI TcpIoAccept ( IN OUT TCP_IO TcpIo,
IN EFI_EVENT Timeout  OPTIONAL 
)

Accept the incomding request from the other endpoint of the TCP socket.

Parameters
[in,out]TcpIoThe TcpIo wrapping the TCP socket.
[in]TimeoutThe time to wait for connection done. Set to NULL for infinite wait.
Return values
EFI_SUCCESSConnect to the other endpoint of the TCP socket successfully.
EFI_INVALID_PARAMETEROne or more parameters are invalid.
EFI_UNSUPPORTEDOne or more of the control options are not supported in the implementation.
EFI_TIMEOUTFailed to connect to the other endpoint of the TCP socket in the specified time period.
OthersOther errors as indicated.

Definition at line 609 of file DxeTcpIoLib.c.

◆ TcpIoConnect()

EFI_STATUS EFIAPI TcpIoConnect ( IN OUT TCP_IO TcpIo,
IN EFI_EVENT Timeout  OPTIONAL 
)

Connect to the other endpoint of the TCP socket.

Parameters
[in,out]TcpIoThe TcpIo wrapping the TCP socket.
[in]TimeoutThe time to wait for connection done. Set to NULL for infinite wait.
Return values
EFI_SUCCESSConnect to the other endpoint of the TCP socket successfully.
EFI_TIMEOUTFailed to connect to the other endpoint of the TCP socket in the specified time period.
EFI_INVALID_PARAMETEROne or more parameters are invalid.
EFI_UNSUPPORTEDOne or more of the control options are not supported in the implementation.
OthersOther errors as indicated.

Definition at line 534 of file DxeTcpIoLib.c.

◆ TcpIoCreateSocket()

EFI_STATUS EFIAPI TcpIoCreateSocket ( IN EFI_HANDLE  Image,
IN EFI_HANDLE  Controller,
IN UINT8  TcpVersion,
IN TCP_IO_CONFIG_DATA ConfigData,
OUT TCP_IO TcpIo 
)

Create a TCP socket with the specified configuration data.

Parameters
[in]ImageThe handle of the driver image.
[in]ControllerThe handle of the controller.
[in]TcpVersionThe version of Tcp, TCP_VERSION_4 or TCP_VERSION_6.
[in]ConfigDataThe Tcp configuration data.
[out]TcpIoThe TcpIo.
Return values
EFI_SUCCESSThe TCP socket is created and configured.
EFI_INVALID_PARAMETEROne or more parameters are invalid.
EFI_UNSUPPORTEDOne or more of the control options are not supported in the implementation.
EFI_OUT_OF_RESOURCESFailed to allocate memory.
OthersFailed to create the TCP socket or configure it.

Definition at line 125 of file DxeTcpIoLib.c.

◆ TcpIoDestroySocket()

VOID EFIAPI TcpIoDestroySocket ( IN TCP_IO TcpIo)

Destroy the socket.

Parameters
[in]TcpIoThe TcpIo which wraps the socket to be destroyed.

Definition at line 397 of file DxeTcpIoLib.c.

◆ TcpIoReceive()

EFI_STATUS EFIAPI TcpIoReceive ( IN OUT TCP_IO TcpIo,
IN NET_BUF Packet,
IN BOOLEAN  AsyncMode,
IN EFI_EVENT Timeout  OPTIONAL 
)

Receive data from the socket.

Parameters
[in,out]TcpIoThe TcpIo which wraps the socket to be destroyed.
[in]PacketThe buffer to hold the data copy from the socket rx buffer.
[in]AsyncModeIs this receive asynchronous or not.
[in]TimeoutThe time to wait for receiving the amount of data the Packet can hold. Set to NULL for infinite wait.
Return values
EFI_SUCCESSThe required amount of data is received from the socket.
EFI_INVALID_PARAMETEROne or more parameters are invalid.
EFI_DEVICE_ERRORAn unexpected network or system error occurred.
EFI_OUT_OF_RESOURCESFailed to allocate memory.
EFI_TIMEOUTFailed to receive the required amount of data in the specified time period.
OthersOther errors as indicated.

Definition at line 872 of file DxeTcpIoLib.c.

◆ TcpIoReset()

VOID EFIAPI TcpIoReset ( IN OUT TCP_IO TcpIo)

Reset the socket.

Parameters
[in,out]TcpIoThe TcpIo wrapping the TCP socket.

Definition at line 694 of file DxeTcpIoLib.c.

◆ TcpIoTransmit()

EFI_STATUS EFIAPI TcpIoTransmit ( IN TCP_IO TcpIo,
IN NET_BUF Packet 
)

Transmit the Packet to the other endpoint of the socket.

Parameters
[in]TcpIoThe TcpIo wrapping the TCP socket.
[in]PacketThe packet to transmit.
Return values
EFI_SUCCESSThe packet is transmitted.
EFI_INVALID_PARAMETEROne or more parameters are invalid.
EFI_UNSUPPORTEDOne or more of the control options are not supported in the implementation.
EFI_OUT_OF_RESOURCESFailed to allocate memory.
EFI_DEVICE_ERRORAn unexpected network or system error occurred.
OthersOther errors as indicated.

Definition at line 752 of file DxeTcpIoLib.c.