TianoCore EDK2 master
Loading...
Searching...
No Matches
Socket.h File Reference

Go to the source code of this file.

Data Structures

struct  _SOCK_COMPLETION_TOKEN
 
union  SOCK_IO_DATA
 
struct  _SOCK_IO_TOKEN
 
struct  _SOCK_BUFFER
 
struct  _SOCK_INIT_DATA
 
union  _NET_PROTOCOL
 
struct  _TCP_SOCKET
 
struct  _SOCK_TOKEN
 
struct  _TCP_RSV_DATA
 

Macros

#define SOCK_SND_BUF   0
 
#define SOCK_RCV_BUF   1
 
#define SOCK_BUFF_LOW_WATER   (2 * 1024)
 
#define SOCK_RCV_BUFF_SIZE   (8 * 1024)
 
#define SOCK_SND_BUFF_SIZE   (8 * 1024)
 
#define SOCK_BACKLOG   5
 
#define PROTO_RESERVED_LEN   20
 
#define SO_NO_MORE_DATA   0x0001
 
#define SO_CLOSED   0
 
#define SO_LISTENING   1
 
#define SO_CONNECTING   2
 
#define SO_CONNECTED   3
 
#define SO_DISCONNECTING   4
 
#define SO_UNCONFIGURED   0
 
#define SO_CONFIGURED_ACTIVE   1
 
#define SO_CONFIGURED_PASSIVE   2
 
#define SO_NO_MAPPING   3
 
#define SOCK_ATTACH   0
 Attach current socket to a new PCB.
 
#define SOCK_DETACH   1
 Detach current socket from the PCB.
 
#define SOCK_CONFIGURE   2
 Configure attached PCB.
 
#define SOCK_FLUSH   3
 Flush attached PCB.
 
#define SOCK_SND   4
 Need protocol to send something.
 
#define SOCK_SNDPUSH   5
 Need protocol to send pushed data.
 
#define SOCK_SNDURG   6
 Need protocol to send urgent data.
 
#define SOCK_CONSUMED   7
 Application has retrieved data from socket.
 
#define SOCK_CONNECT   8
 Need to connect to a peer.
 
#define SOCK_CLOSE   9
 Need to close the protocol process.
 
#define SOCK_ABORT   10
 Need to reset the protocol process.
 
#define SOCK_POLL   11
 Need to poll to the protocol layer.
 
#define SOCK_ROUTE   12
 Need to add a route information.
 
#define SOCK_MODE   13
 Need to get the mode data of the protocol.
 
#define SOCK_GROUP   14
 Need to join a mcast group.
 
#define SOCK_NO_MORE_DATA(Sock)   ((Sock)->Flag |= SO_NO_MORE_DATA)
 
#define SOCK_IS_UNCONFIGURED(Sock)   ((Sock)->ConfigureState == SO_UNCONFIGURED)
 
#define SOCK_IS_CONFIGURED(Sock)
 
#define SOCK_IS_CONFIGURED_ACTIVE(Sock)   ((Sock)->ConfigureState == SO_CONFIGURED_ACTIVE)
 
#define SOCK_IS_CONNECTED_PASSIVE(Sock)   ((Sock)->ConfigureState == SO_CONFIGURED_PASSIVE)
 
#define SOCK_IS_NO_MAPPING(Sock)   ((Sock)->ConfigureState == SO_NO_MAPPING)
 
#define SOCK_IS_CLOSED(Sock)   ((Sock)->State == SO_CLOSED)
 
#define SOCK_IS_LISTENING(Sock)   ((Sock)->State == SO_LISTENING)
 
#define SOCK_IS_CONNECTING(Sock)   ((Sock)->State == SO_CONNECTING)
 
#define SOCK_IS_CONNECTED(Sock)   ((Sock)->State == SO_CONNECTED)
 
#define SOCK_IS_DISCONNECTING(Sock)   ((Sock)->State == SO_DISCONNECTING)
 
#define SOCK_IS_NO_MORE_DATA(Sock)   (0 != ((Sock)->Flag & SO_NO_MORE_DATA))
 
#define SET_RCV_BUFFSIZE(Sock, Size)   ((Sock)->RcvBuffer.HighWater = (Size))
 
#define GET_RCV_BUFFSIZE(Sock)   ((Sock)->RcvBuffer.HighWater)
 
#define GET_RCV_DATASIZE(Sock)   (((Sock)->RcvBuffer.DataQueue)->BufSize)
 
#define SET_SND_BUFFSIZE(Sock, Size)   ((Sock)->SndBuffer.HighWater = (Size))
 
#define GET_SND_BUFFSIZE(Sock)   ((Sock)->SndBuffer.HighWater)
 
#define GET_SND_DATASIZE(Sock)   (((Sock)->SndBuffer.DataQueue)->BufSize)
 
#define SET_BACKLOG(Sock, Value)   ((Sock)->BackLog = (Value))
 
#define GET_BACKLOG(Sock)   ((Sock)->BackLog)
 
#define SOCK_ERROR(Sock, Error)   ((Sock)->SockError = (Error))
 
#define SOCK_SIGNATURE   SIGNATURE_32 ('S', 'O', 'C', 'K')
 
#define SOCK_FROM_THIS(a)   CR ((a), SOCKET, NetProtocol, SOCK_SIGNATURE)
 
#define SOCK_FROM_TOKEN(Token)   (((SOCK_TOKEN *) (Token))->Sock)
 
#define PROTO_TOKEN_FORM_SOCK(SockToken, Type)   ((Type *) (((SOCK_TOKEN *) (SockToken))->Token))
 

Typedefs

typedef struct _TCP_SOCKET SOCKET
 
typedef struct _SOCK_COMPLETION_TOKEN SOCK_COMPLETION_TOKEN
 
typedef struct _SOCK_IO_TOKEN SOCK_IO_TOKEN
 
typedef struct _SOCK_BUFFER SOCK_BUFFER
 
typedef EFI_STATUS(* SOCK_PROTO_HANDLER) (IN SOCKET *Socket, IN UINT8 Request, IN VOID *RequestData)
 
typedef EFI_STATUS(* SOCK_CREATE_CALLBACK) (IN SOCKET *This, IN VOID *Context)
 
typedef VOID(* SOCK_DESTROY_CALLBACK) (IN SOCKET *This, IN VOID *Context)
 
typedef struct _SOCK_INIT_DATA SOCK_INIT_DATA
 
typedef union _NET_PROTOCOL NET_PROTOCOL
 
typedef struct _SOCK_TOKEN SOCK_TOKEN
 
typedef struct _TCP_RSV_DATA TCP_RSV_DATA
 

Enumerations

enum  SOCK_TYPE { SockDgram , SockStream }
 

Functions

VOID SockSetState (IN OUT SOCKET *Sock, IN UINT8 State)
 
SOCKETSockClone (IN SOCKET *Sock)
 
VOID SockConnEstablished (IN OUT SOCKET *Sock)
 
VOID SockConnClosed (IN OUT SOCKET *Sock)
 
VOID SockDataSent (IN OUT SOCKET *Sock, IN UINT32 Count)
 
UINT32 SockGetDataToSend (IN SOCKET *Sock, IN UINT32 Offset, IN UINT32 Len, OUT UINT8 *Dest)
 
VOID SockDataRcvd (IN OUT SOCKET *Sock, IN OUT NET_BUF *NetBuffer, IN UINT32 UrgLen)
 
UINT32 SockGetFreeSpace (IN SOCKET *Sock, IN UINT32 Which)
 
VOID SockNoMoreData (IN OUT SOCKET *Sock)
 
SOCKETSockCreateChild (IN SOCK_INIT_DATA *SockInitData)
 
EFI_STATUS SockDestroyChild (IN OUT SOCKET *Sock)
 
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

Common head file for TCP socket.

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

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

Definition in file Socket.h.

Macro Definition Documentation

◆ GET_BACKLOG

#define GET_BACKLOG (   Sock)    ((Sock)->BackLog)

Get the backlog value of the socket.

Parameters
[in]SockPointer to the socket.
Returns
The backlog value.

Definition at line 303 of file Socket.h.

◆ GET_RCV_BUFFSIZE

#define GET_RCV_BUFFSIZE (   Sock)    ((Sock)->RcvBuffer.HighWater)

Get the size of the receive buffer.

Parameters
[in]SockPointer to the socket.
Returns
The receive buffer size.

Definition at line 245 of file Socket.h.

◆ GET_RCV_DATASIZE

#define GET_RCV_DATASIZE (   Sock)    (((Sock)->RcvBuffer.DataQueue)->BufSize)

Get the size of the receive data.

Parameters
[in]SockPointer to the socket.
Returns
The received data size.

Definition at line 255 of file Socket.h.

◆ GET_SND_BUFFSIZE

#define GET_SND_BUFFSIZE (   Sock)    ((Sock)->SndBuffer.HighWater)

Get the size of the send buffer.

Parameters
[in]SockPointer to the socket.
Returns
The send buffer size.

Definition at line 274 of file Socket.h.

◆ GET_SND_DATASIZE

#define GET_SND_DATASIZE (   Sock)    (((Sock)->SndBuffer.DataQueue)->BufSize)

Get the size of the send data.

Parameters
[in]SockPointer to the socket.
Returns
The send data size.

Definition at line 284 of file Socket.h.

◆ PROTO_RESERVED_LEN

#define PROTO_RESERVED_LEN   20

Definition at line 35 of file Socket.h.

◆ PROTO_TOKEN_FORM_SOCK

#define PROTO_TOKEN_FORM_SOCK (   SockToken,
  Type 
)    ((Type *) (((SOCK_TOKEN *) (SockToken))->Token))

Definition at line 320 of file Socket.h.

◆ SET_BACKLOG

#define SET_BACKLOG (   Sock,
  Value 
)    ((Sock)->BackLog = (Value))

Set the backlog value of the socket.

Parameters
[in]SockPointer to the socket.
[in]ValueThe value to set.

Definition at line 293 of file Socket.h.

◆ SET_RCV_BUFFSIZE

#define SET_RCV_BUFFSIZE (   Sock,
  Size 
)    ((Sock)->RcvBuffer.HighWater = (Size))

Set the size of the receive buffer.

Parameters
[in]SockPointer to the socket.
[in]SizeThe size to set.

Definition at line 235 of file Socket.h.

◆ SET_SND_BUFFSIZE

#define SET_SND_BUFFSIZE (   Sock,
  Size 
)    ((Sock)->SndBuffer.HighWater = (Size))

Set the size of the send buffer.

Parameters
[in]SockPointer to the socket.
[in]SizeThe size to set.

Definition at line 264 of file Socket.h.

◆ SO_CLOSED

#define SO_CLOSED   0

Socket state

Definition at line 64 of file Socket.h.

◆ SO_CONFIGURED_ACTIVE

#define SO_CONFIGURED_ACTIVE   1

Definition at line 74 of file Socket.h.

◆ SO_CONFIGURED_PASSIVE

#define SO_CONFIGURED_PASSIVE   2

Definition at line 75 of file Socket.h.

◆ SO_CONNECTED

#define SO_CONNECTED   3

Definition at line 67 of file Socket.h.

◆ SO_CONNECTING

#define SO_CONNECTING   2

Definition at line 66 of file Socket.h.

◆ SO_DISCONNECTING

#define SO_DISCONNECTING   4

Definition at line 68 of file Socket.h.

◆ SO_LISTENING

#define SO_LISTENING   1

Definition at line 65 of file Socket.h.

◆ SO_NO_MAPPING

#define SO_NO_MAPPING   3

Definition at line 76 of file Socket.h.

◆ SO_NO_MORE_DATA

#define SO_NO_MORE_DATA   0x0001

Definition at line 37 of file Socket.h.

◆ SO_UNCONFIGURED

#define SO_UNCONFIGURED   0

Socket configure state

Definition at line 73 of file Socket.h.

◆ SOCK_ABORT

#define SOCK_ABORT   10

Need to reset the protocol process.

Definition at line 91 of file Socket.h.

◆ SOCK_ATTACH

#define SOCK_ATTACH   0

Attach current socket to a new PCB.

The request issued from socket layer to protocol layer.

Definition at line 81 of file Socket.h.

◆ SOCK_BACKLOG

#define SOCK_BACKLOG   5

Definition at line 33 of file Socket.h.

◆ SOCK_BUFF_LOW_WATER

#define SOCK_BUFF_LOW_WATER   (2 * 1024)

Definition at line 30 of file Socket.h.

◆ SOCK_CLOSE

#define SOCK_CLOSE   9

Need to close the protocol process.

Definition at line 90 of file Socket.h.

◆ SOCK_CONFIGURE

#define SOCK_CONFIGURE   2

Configure attached PCB.

Definition at line 83 of file Socket.h.

◆ SOCK_CONNECT

#define SOCK_CONNECT   8

Need to connect to a peer.

Definition at line 89 of file Socket.h.

◆ SOCK_CONSUMED

#define SOCK_CONSUMED   7

Application has retrieved data from socket.

Definition at line 88 of file Socket.h.

◆ SOCK_DETACH

#define SOCK_DETACH   1

Detach current socket from the PCB.

Definition at line 82 of file Socket.h.

◆ SOCK_ERROR

#define SOCK_ERROR (   Sock,
  Error 
)    ((Sock)->SockError = (Error))

Set the socket with error state.

Parameters
[in]SockPointer to the socket.
[in]ErrorThe error state.

Definition at line 312 of file Socket.h.

◆ SOCK_FLUSH

#define SOCK_FLUSH   3

Flush attached PCB.

Definition at line 84 of file Socket.h.

◆ SOCK_FROM_THIS

#define SOCK_FROM_THIS (   a)    CR ((a), SOCKET, NetProtocol, SOCK_SIGNATURE)

Definition at line 316 of file Socket.h.

◆ SOCK_FROM_TOKEN

#define SOCK_FROM_TOKEN (   Token)    (((SOCK_TOKEN *) (Token))->Sock)

Definition at line 318 of file Socket.h.

◆ SOCK_GROUP

#define SOCK_GROUP   14

Need to join a mcast group.

Definition at line 95 of file Socket.h.

◆ SOCK_IS_CLOSED

#define SOCK_IS_CLOSED (   Sock)    ((Sock)->State == SO_CLOSED)

Check whether the socket is closed.

Parameters
[in]SockPointer to the socket.
Return values
TRUEThe socket is closed.
FALSEThe socket is not closed.

Definition at line 171 of file Socket.h.

◆ SOCK_IS_CONFIGURED

#define SOCK_IS_CONFIGURED (   Sock)
Value:
(((Sock)->ConfigureState == SO_CONFIGURED_ACTIVE) || \
((Sock)->ConfigureState == SO_CONFIGURED_PASSIVE))

Check whether the socket is configured.

Parameters
[in]SockPointer to the socket
Return values
TRUEThe socket is configured
FALSEThe socket is not configured

Definition at line 125 of file Socket.h.

◆ SOCK_IS_CONFIGURED_ACTIVE

#define SOCK_IS_CONFIGURED_ACTIVE (   Sock)    ((Sock)->ConfigureState == SO_CONFIGURED_ACTIVE)

Check whether the socket is configured to active mode.

Parameters
[in]SockPointer to the socket.
Return values
TRUEThe socket is configured to active mode.
FALSEThe socket is not configured to active mode.

Definition at line 138 of file Socket.h.

◆ SOCK_IS_CONNECTED

#define SOCK_IS_CONNECTED (   Sock)    ((Sock)->State == SO_CONNECTED)

Check whether the socket has connected.

Parameters
[in]SockPointer to the socket.
Return values
TRUEThe socket has connected.
FALSEThe socket has not connected.

Definition at line 204 of file Socket.h.

◆ SOCK_IS_CONNECTED_PASSIVE

#define SOCK_IS_CONNECTED_PASSIVE (   Sock)    ((Sock)->ConfigureState == SO_CONFIGURED_PASSIVE)

Check whether the socket is configured to passive mode.

Parameters
[in]SockPointer to the socket.
Return values
TRUEThe socket is configured to passive mode.
FALSEThe socket is not configured to passive mode.

Definition at line 149 of file Socket.h.

◆ SOCK_IS_CONNECTING

#define SOCK_IS_CONNECTING (   Sock)    ((Sock)->State == SO_CONNECTING)

Check whether the socket is connecting.

Parameters
[in]SockPointer to the socket.
Return values
TRUEThe socket is connecting.
FALSEThe socket is not connecting.

Definition at line 193 of file Socket.h.

◆ SOCK_IS_DISCONNECTING

#define SOCK_IS_DISCONNECTING (   Sock)    ((Sock)->State == SO_DISCONNECTING)

Check whether the socket is disconnecting.

Parameters
[in]SockPointer to the socket.
Return values
TRUEThe socket is disconnecting.
FALSEThe socket is not disconnecting.

Definition at line 215 of file Socket.h.

◆ SOCK_IS_LISTENING

#define SOCK_IS_LISTENING (   Sock)    ((Sock)->State == SO_LISTENING)

Check whether the socket is listening.

Parameters
[in]SockPointer to the socket.
Return values
TRUEThe socket is listening.
FALSEThe socket is not listening.

Definition at line 182 of file Socket.h.

◆ SOCK_IS_NO_MAPPING

#define SOCK_IS_NO_MAPPING (   Sock)    ((Sock)->ConfigureState == SO_NO_MAPPING)

Check whether the socket is mapped.

Parameters
[in]SockPointer to the socket.
Return values
TRUEThe socket is not mapping.
FALSEThe socket is mapped.

Definition at line 160 of file Socket.h.

◆ SOCK_IS_NO_MORE_DATA

#define SOCK_IS_NO_MORE_DATA (   Sock)    (0 != ((Sock)->Flag & SO_NO_MORE_DATA))

Check whether the socket is no more data.

Parameters
[in]SockPointer to the socket.
Return values
TRUEThe socket is no more data.
FALSEThe socket still has data.

Definition at line 226 of file Socket.h.

◆ SOCK_IS_UNCONFIGURED

#define SOCK_IS_UNCONFIGURED (   Sock)    ((Sock)->ConfigureState == SO_UNCONFIGURED)

Check whether the socket is unconfigured.

Parameters
[in]SockPointer to the socket.
Return values
TRUEThe socket is unconfigured.
FALSEThe socket is not unconfigured.

Definition at line 114 of file Socket.h.

◆ SOCK_MODE

#define SOCK_MODE   13

Need to get the mode data of the protocol.

Definition at line 94 of file Socket.h.

◆ SOCK_NO_MORE_DATA

#define SOCK_NO_MORE_DATA (   Sock)    ((Sock)->Flag |= SO_NO_MORE_DATA)

Set socket SO_NO_MORE_DATA flag.

Parameters
[in]SockPointer to the socket

Definition at line 103 of file Socket.h.

◆ SOCK_POLL

#define SOCK_POLL   11

Need to poll to the protocol layer.

Definition at line 92 of file Socket.h.

◆ SOCK_RCV_BUF

#define SOCK_RCV_BUF   1

Definition at line 28 of file Socket.h.

◆ SOCK_RCV_BUFF_SIZE

#define SOCK_RCV_BUFF_SIZE   (8 * 1024)

Definition at line 31 of file Socket.h.

◆ SOCK_ROUTE

#define SOCK_ROUTE   12

Need to add a route information.

Definition at line 93 of file Socket.h.

◆ SOCK_SIGNATURE

#define SOCK_SIGNATURE   SIGNATURE_32 ('S', 'O', 'C', 'K')

Definition at line 314 of file Socket.h.

◆ SOCK_SND

#define SOCK_SND   4

Need protocol to send something.

Definition at line 85 of file Socket.h.

◆ SOCK_SND_BUF

#define SOCK_SND_BUF   0

Definition at line 27 of file Socket.h.

◆ SOCK_SND_BUFF_SIZE

#define SOCK_SND_BUFF_SIZE   (8 * 1024)

Definition at line 32 of file Socket.h.

◆ SOCK_SNDPUSH

#define SOCK_SNDPUSH   5

Need protocol to send pushed data.

Definition at line 86 of file Socket.h.

◆ SOCK_SNDURG

#define SOCK_SNDURG   6

Need protocol to send urgent data.

Definition at line 87 of file Socket.h.

Typedef Documentation

◆ NET_PROTOCOL

typedef union _NET_PROTOCOL NET_PROTOCOL

The union type of TCP4 and TCP6 protocol.

◆ SOCK_BUFFER

typedef struct _SOCK_BUFFER SOCK_BUFFER

The buffer structure of rcvd data and send data used by socket.

◆ SOCK_COMPLETION_TOKEN

Socket completion token

◆ SOCK_CREATE_CALLBACK

typedef EFI_STATUS(* SOCK_CREATE_CALLBACK) (IN SOCKET *This, IN VOID *Context)

The Callback function called after the TCP socket is created.

Parameters
[in]ThisPointer to the socket just created.
[in]ContextContext of the socket.
Return values
EFI_SUCCESSThis protocol installed successfully.
otherSome error occurred.

Definition at line 393 of file Socket.h.

◆ SOCK_DESTROY_CALLBACK

typedef VOID(* SOCK_DESTROY_CALLBACK) (IN SOCKET *This, IN VOID *Context)

The callback function called before the TCP socket is to be destroyed.

Parameters
[in]ThisThe TCP socket to be destroyed.
[in]ContextThe context.

Definition at line 407 of file Socket.h.

◆ SOCK_INIT_DATA

The initialize data for create a new socket.

◆ SOCK_IO_TOKEN

typedef struct _SOCK_IO_TOKEN SOCK_IO_TOKEN

The application token with data packet

◆ SOCK_PROTO_HANDLER

typedef EFI_STATUS(* SOCK_PROTO_HANDLER) (IN SOCKET *Socket, IN UINT8 Request, IN VOID *RequestData)

The handler of protocol for request from socket.

Parameters
[in]SocketThe socket issuing the request to protocol.
[in]RequestThe request issued by socket.
[in]RequestDataThe request related data.
Return values
EFI_SUCCESSThe socket request is completed successfully.
otherThe error status returned by the corresponding TCP layer function.

Definition at line 375 of file Socket.h.

◆ SOCK_TOKEN

typedef struct _SOCK_TOKEN SOCK_TOKEN

The token structure buffered in socket layer.

◆ SOCKET

typedef struct _TCP_SOCKET SOCKET

Definition at line 322 of file Socket.h.

◆ TCP_RSV_DATA

typedef struct _TCP_RSV_DATA TCP_RSV_DATA

Reserved data to access the NET_BUF delivered by TCP driver.

Enumeration Type Documentation

◆ SOCK_TYPE

enum SOCK_TYPE

The socket type.

Enumerator
SockDgram 

This socket providing datagram service.

SockStream 

This socket providing stream service.

Definition at line 348 of file Socket.h.

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 acceptance.
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 limit.

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.

◆ 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.

◆ SockClone()

SOCKET * SockClone ( IN SOCKET Sock)

Clone a new socket including its associated protocol control block.

Parameters
[in]SockPointer to the socket to be cloned.
Returns
Pointer to the newly cloned socket. If NULL, an error condition occurred.

Clone a new socket, including its associated protocol control block.

Parameters
[in]SockPointer to the socket to be cloned.
Returns
Pointer to the newly cloned socket. If NULL, an error condition occurred.

Definition at line 937 of file SockImpl.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 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.

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.

◆ SockConnClosed()

VOID SockConnClosed ( IN OUT SOCKET Sock)

Called by the low layer protocol to indicate that the connection is closed.

This function flushes the socket, sets the state to SO_CLOSED, and signals the close token.

Parameters
[in,out]SockPointer to the socket associated with the closed connection.

Called by the low layer protocol to indicate the connection is closed.

This function flushes the socket, sets the state to SO_CLOSED, and signals the close token.

Parameters
[in,out]SockPointer to the socket associated with the closed connection.

Definition at line 1011 of file SockImpl.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.

◆ SockConnEstablished()

VOID SockConnEstablished ( IN OUT SOCKET Sock)

Called by the low layer protocol to indicate the socket a connection is established.

This function just changes the socket's state to SO_CONNECTED and signals the token used for connection establishment.

Parameters
[in,out]SockPointer to the socket associated with the established connection.

Definition at line 985 of file SockImpl.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.

◆ SockDataRcvd()

VOID SockDataRcvd ( IN OUT SOCKET Sock,
IN OUT NET_BUF NetBuffer,
IN UINT32  UrgLen 
)

Called by the low layer protocol to deliver received data to socket layer.

This function appends the data to the socket receive buffer, set the urgent data length, then checks if any receive token can be signaled.

Parameters
[in,out]SockPointer to the socket.
[in,out]NetBufferPointer to the buffer that contains the received data.
[in]UrgLenThe length of the urgent data in the received data.

Called by the low layer protocol to deliver received data to socket layer.

This function will append the data to the socket receive buffer, set the urgent data length, and then check if any receive token can be signaled.

Parameters
[in,out]SockPointer to the socket.
[in,out]NetBufferPointer to the buffer that contains the received data.
[in]UrgLenThe length of the urgent data in the received data.

Definition at line 1125 of file SockImpl.c.

◆ SockDataSent()

VOID SockDataSent ( IN OUT SOCKET Sock,
IN UINT32  Count 
)

Called by low layer protocol to indicate that some data is sent or processed.

This function trims the sent data in the socket send buffer and signals the data token, if proper.

Parameters
[in,out]SockPointer to the socket.
[in]CountThe length of the data processed or sent, in bytes.

Called by low layer protocol to indicate that some data was sent or processed.

This function trims the sent data in the socket send buffer, and signals the data token if proper.

Parameters
[in,out]SockPointer to the socket.
[in]CountThe length of the data processed or sent, in bytes.

Definition at line 1039 of file SockImpl.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 flushed successfully.
EFI_ACCESS_DENIEDFailed to get the lock to access the socket.

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.

◆ SockGetDataToSend()

UINT32 SockGetDataToSend ( IN SOCKET Sock,
IN UINT32  Offset,
IN UINT32  Len,
OUT UINT8 *  Dest 
)

Called by the low layer protocol to copy some data in socket send buffer starting from the specific offset to a buffer provided by the caller.

Parameters
[in]SockPointer to the socket.
[in]OffsetThe start point of the data to be copied.
[in]LenThe length of the data to be copied.
[out]DestPointer to the destination to copy the data.
Returns
The data size copied.

Called by the low layer protocol to copy some data in the socket send buffer starting from the specific offset to a buffer provided by the caller.

Parameters
[in]SockPointer to the socket.
[in]OffsetThe start point of the data to be copied.
[in]LenThe length of the data to be copied.
[out]DestPointer to the destination to copy the data.
Returns
The data size copied.

Definition at line 1096 of file SockImpl.c.

◆ SockGetFreeSpace()

UINT32 SockGetFreeSpace ( IN SOCKET Sock,
IN UINT32  Which 
)

Get the length of the free space of the specific socket buffer.

Parameters
[in]SockPointer to the socket.
[in]WhichFlag to indicate which socket buffer to check: either send buffer or receive buffer.
Returns
The length of the free space, in bytes.

Definition at line 1156 of file SockImpl.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.

◆ SockNoMoreData()

VOID SockNoMoreData ( IN OUT SOCKET Sock)

Called by the low layer protocol to indicate that there will be no more data from the communication peer.

This function sets the socket's state to SO_NO_MORE_DATA and signals all queued IO tokens with the error status EFI_CONNECTION_FIN.

Parameters
[in,out]SockPointer to the socket.

Definition at line 1192 of file SockImpl.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 a memory limit.

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 a memory limit.

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.

◆ SockSetState()

VOID SockSetState ( IN OUT SOCKET Sock,
IN UINT8  State 
)

Set the state of the socket.

Parameters
[in,out]SockPointer to the socket.
[in]StateThe new socket state to be set.

Definition at line 920 of file SockImpl.c.