TianoCore EDK2 master
Loading...
Searching...
No Matches
SockInterface.c File Reference
#include "SockImpl.h"

Go to the source code of this file.

Functions

BOOLEAN SockTokenExistedInList (IN LIST_ENTRY *List, IN EFI_EVENT Event)
 
BOOLEAN SockTokenExisted (IN SOCKET *Sock, IN EFI_EVENT Event)
 
SOCK_TOKENSockBufferToken (IN SOCKET *Sock, IN LIST_ENTRY *List, IN VOID *Token, IN UINT32 DataLen)
 
EFI_STATUS SockDestroyChild (IN OUT SOCKET *Sock)
 
SOCKETSockCreateChild (IN SOCK_INIT_DATA *SockInitData)
 
EFI_STATUS SockConfigure (IN SOCKET *Sock, IN VOID *ConfigData)
 
EFI_STATUS SockConnect (IN SOCKET *Sock, IN VOID *Token)
 
EFI_STATUS SockAccept (IN SOCKET *Sock, IN VOID *Token)
 
EFI_STATUS SockSend (IN SOCKET *Sock, IN VOID *Token)
 
EFI_STATUS SockRcv (IN SOCKET *Sock, IN VOID *Token)
 
EFI_STATUS SockFlush (IN OUT SOCKET *Sock)
 
EFI_STATUS SockClose (IN OUT SOCKET *Sock, IN VOID *Token, IN BOOLEAN OnAbort)
 
EFI_STATUS SockCancel (IN OUT SOCKET *Sock, IN VOID *Token)
 
EFI_STATUS SockGetMode (IN SOCKET *Sock, IN OUT VOID *Mode)
 
EFI_STATUS SockRoute (IN SOCKET *Sock, IN VOID *RouteInfo)
 

Detailed Description

Interface function of the Socket.

Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file SockInterface.c.

Function Documentation

◆ SockAccept()

EFI_STATUS SockAccept ( IN SOCKET Sock,
IN VOID *  Token 
)

Issue a listen token to get an existed connected network instance or wait for a connection if there is none.

Parameters
[in]SockPointer to the socket to accept connections.
[in]TokenThe token to accept a connection.
Return values
EFI_SUCCESSEither a connection is accepted or the Token is buffered for further acception.
EFI_ACCESS_DENIEDFailed to get the lock to access the socket, or the socket is closed, or the socket is not configured to be a passive one, or the token is already in one of this socket's lists.
EFI_NO_MAPPINGThe IP address configuration operation is not finished.
EFI_NOT_STARTEDThe socket is not configured.
EFI_OUT_OF_RESOURCEFailed to buffer the Token due to memory limits.

Definition at line 476 of file SockInterface.c.

◆ SockBufferToken()

SOCK_TOKEN * SockBufferToken ( IN SOCKET Sock,
IN LIST_ENTRY List,
IN VOID *  Token,
IN UINT32  DataLen 
)

Buffer a token into the specific list of the socket Sock.

Parameters
[in]SockPointer to the instance's socket.
[in]ListPointer to the list to store the token.
[in]TokenPointer to the token to be buffered.
[in]DataLenThe data length of the buffer contained in Token.
Returns
Pointer to the token that wraps Token. If NULL, an error condition occurred.

Definition at line 95 of file SockInterface.c.

◆ SockCancel()

EFI_STATUS SockCancel ( IN OUT SOCKET Sock,
IN VOID *  Token 
)

Abort the socket associated connection, listen, transmission or receive request.

Parameters
[in,out]SockPointer to the socket to abort.
[in]TokenPointer to a token that has been issued by Connect(), Accept(), Transmit() or Receive(). If NULL, all pending tokens issued by the four functions listed above will be aborted.
Return values
EFI_UNSUPPORTEDThe operation is not supported in the current implementation.

Definition at line 937 of file SockInterface.c.

◆ SockClose()

EFI_STATUS SockClose ( IN OUT SOCKET Sock,
IN VOID *  Token,
IN BOOLEAN  OnAbort 
)

Close or abort the socket associated connection.

Parameters
[in,out]SockPointer to the socket of the connection to close or abort.
[in]TokenThe token for a close operation.
[in]OnAbortTRUE for aborting the connection; FALSE to close it.
Return values
EFI_SUCCESSThe close or abort operation initialized successfully.
EFI_ACCESS_DENIEDFailed to get the lock to access the socket, or the socket is closed, or the socket is not in a synchronized state , or the token is already in one of this socket's lists.
EFI_NO_MAPPINGThe IP address configuration operation is not finished.
EFI_NOT_STARTEDThe socket is not configured.

Definition at line 866 of file SockInterface.c.

◆ SockConfigure()

EFI_STATUS SockConfigure ( IN SOCKET Sock,
IN VOID *  ConfigData 
)

Configure the specific socket Sock using configuration data ConfigData.

Parameters
[in]SockPointer to the socket to be configured.
[in]ConfigDataPointer to the configuration data.
Return values
EFI_SUCCESSThe socket configured successfully.
EFI_ACCESS_DENIEDFailed to get the lock to access the socket, or the socket is already configured.

Definition at line 354 of file SockInterface.c.

◆ SockConnect()

EFI_STATUS SockConnect ( IN SOCKET Sock,
IN VOID *  Token 
)

Initiate a connection establishment process.

Parameters
[in]SockPointer to the socket to initiate the connection.
[in]TokenPointer to the token used for the connection operation.
Return values
EFI_SUCCESSThe connection initialized successfully.
EFI_ACCESS_DENIEDFailed to get the lock to access the socket, or the socket is closed, or the socket is not configured to be an active one, or the token is already in one of this socket's lists.
EFI_NO_MAPPINGThe IP address configuration operation is not finished.
EFI_NOT_STARTEDThe socket is not configured.

Definition at line 406 of file SockInterface.c.

◆ SockCreateChild()

SOCKET * SockCreateChild ( IN SOCK_INIT_DATA SockInitData)

Create a socket and its associated protocol control block with the initial data SockInitData and protocol specific data ProtoData.

Parameters
[in]SockInitDataInitial data to setting the socket.
Returns
Pointer to the newly created socket. If NULL, an error condition occurred.

Definition at line 260 of file SockInterface.c.

◆ SockDestroyChild()

EFI_STATUS SockDestroyChild ( IN OUT SOCKET Sock)

Destroy the socket Sock and its associated protocol control block.

Parameters
[in,out]SockThe socket to be destroyed.
Return values
EFI_SUCCESSThe socket Sock was destroyed successfully.
EFI_ACCESS_DENIEDFailed to get the lock to access the socket.

Definition at line 132 of file SockInterface.c.

◆ SockFlush()

EFI_STATUS SockFlush ( IN OUT SOCKET Sock)

Reset the socket and its associated protocol control block.

Parameters
[in,out]SockPointer to the socket to be flushed.
Return values
EFI_SUCCESSThe socket is flushed successfully.
EFI_ACCESS_DENIEDFailed to get the lock to access the socket.

Definition at line 800 of file SockInterface.c.

◆ SockGetMode()

EFI_STATUS SockGetMode ( IN SOCKET Sock,
IN OUT VOID *  Mode 
)

Get the mode data of the low layer protocol.

Parameters
[in]SockPointer to the socket to get mode data from.
[in,out]ModePointer to the data to store the low layer mode information.
Return values
EFI_SUCCESSThe mode data was obtained successfully.
EFI_NOT_STARTEDThe socket is not configured.

Definition at line 1025 of file SockInterface.c.

◆ SockRcv()

EFI_STATUS SockRcv ( IN SOCKET Sock,
IN VOID *  Token 
)

Issue a token to get data from the socket.

Parameters
[in]SockPointer to the socket to get data from.
[in]TokenThe token to store the received data from the socket.
Return values
EFI_SUCCESSThe token processed successfully.
EFI_ACCESS_DENIEDFailed to get the lock to access the socket, or the socket is closed, or the socket is not in a synchronized state , or the token is already in one of this socket's lists.
EFI_NO_MAPPINGThe IP address configuration operation is not finished.
EFI_NOT_STARTEDThe socket is not configured.
EFI_CONNECTION_FINThe connection is closed and there is no more data.
EFI_OUT_OF_RESOURCEFailed to buffer the token due to memory limit.

Definition at line 705 of file SockInterface.c.

◆ SockRoute()

EFI_STATUS SockRoute ( IN SOCKET Sock,
IN VOID *  RouteInfo 
)

Add or remove route information in IP route table associated with this socket.

Parameters
[in]SockPointer to the socket associated with the IP route table to operate on.
[in]RouteInfoPointer to the route information to be processed.
Return values
EFI_SUCCESSThe route table updated successfully.
EFI_ACCESS_DENIEDFailed to get the lock to access the socket.
EFI_NO_MAPPINGThe IP address configuration operation is not finished.
EFI_NOT_STARTEDThe socket is not configured.

Definition at line 1049 of file SockInterface.c.

◆ SockSend()

EFI_STATUS SockSend ( IN SOCKET Sock,
IN VOID *  Token 
)

Issue a token with data to the socket to send out.

Parameters
[in]SockPointer to the socket to process the token with data.
[in]TokenThe token with data that needs to send out.
Return values
EFI_SUCCESSThe token processed successfully.
EFI_ACCESS_DENIEDFailed to get the lock to access the socket, or the socket is closed, or the socket is not in a synchronized state , or the token is already in one of this socket's lists.
EFI_NO_MAPPINGThe IP address configuration operation is not finished.
EFI_NOT_STARTEDThe socket is not configured.
EFI_OUT_OF_RESOURCEFailed to buffer the token due to memory limits.

Definition at line 583 of file SockInterface.c.

◆ SockTokenExisted()

BOOLEAN SockTokenExisted ( IN SOCKET Sock,
IN EFI_EVENT  Event 
)

Call SockTokenExistedInList() to check whether the Event is in the related socket's lists.

Parameters
[in]SockPointer to the instance's socket.
[in]EventThe event to be checked.
Return values
TRUEThe Event exists in related socket's lists.
FALSEThe Event is not in related socket's lists.

Definition at line 58 of file SockInterface.c.

◆ SockTokenExistedInList()

BOOLEAN SockTokenExistedInList ( IN LIST_ENTRY List,
IN EFI_EVENT  Event 
)

Check whether the Event is in the List.

Parameters
[in]ListPointer to the token list to be searched.
[in]EventThe event to be checked.
Return values
TRUEThe specific Event exists in the List.
FALSEThe specific Event is not in the List.

Definition at line 23 of file SockInterface.c.