NetworkPkg/TcpDxe/Socket.h File Reference


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

Defines

#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 SockGetMode (IN SOCKET *Sock, IN OUT VOID *Mode)
EFI_STATUS SockGroup (IN SOCKET *Sock, IN VOID *GroupInfo)
EFI_STATUS SockRoute (IN SOCKET *Sock, IN VOID *RouteInfo)

Detailed Description

Common head file for TCP socket.

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

This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php.

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.


Define Documentation

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

Get the backlog value of the socket.

Parameters:
[in] Sock Pointer to the socket.
Returns:
The backlog value.

Referenced by Tcp4GetMode(), and Tcp6GetMode().

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

Get the size of the receive buffer.

Parameters:
[in] Sock Pointer to the socket.
Returns:
The receive buffer size.

Referenced by Tcp4GetMode(), Tcp6GetMode(), TcpComputeScale(), TcpComputeWnd(), TcpInitTcbLocal(), and TcpRcvWinNow().

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

Get the size of the receive data.

Parameters:
[in] Sock Pointer to the socket.
Returns:
The received data size.

Referenced by SockNoMoreData(), SockRcv(), and TcpOnAppClose().

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

Get the size of the send buffer.

Parameters:
[in] Sock Pointer to the socket.
Returns:
The send buffer size.

Referenced by Tcp4GetMode(), and Tcp6GetMode().

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

Get the size of the send data.

Parameters:
[in] Sock Pointer to the socket.
Returns:
The send data size.

Referenced by TcpDataToSend(), TcpDispatcher(), TcpToSendData(), and TcpTransmitSegment().

#define PROTO_RESERVED_LEN   20

Referenced by SockCreate().

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

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

Set the backlog value of the socket.

Parameters:
[in] Sock Pointer to the socket.
[in] Value The value to set.

Referenced by TcpConfigurePcb().

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

Set the size of the receive buffer.

Parameters:
[in] Sock Pointer to the socket.
[in] Size The size to set.

Referenced by TcpConfigurePcb().

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

Set the size of the send buffer.

Parameters:
[in] Sock Pointer to the socket.
[in] Size The size to set.

Referenced by TcpConfigurePcb().

#define SO_CLOSED   0

#define SO_CONFIGURED_ACTIVE   1

Referenced by TcpConfigurePcb().

#define SO_CONFIGURED_PASSIVE   2

Referenced by TcpConfigurePcb().

#define SO_CONNECTED   3

Referenced by SockConnEstablished().

#define SO_CONNECTING   2

#define SO_DISCONNECTING   4

Referenced by SockClose().

#define SO_LISTENING   1

Referenced by TcpConfigurePcb().

#define SO_NO_MAPPING   3

Referenced by Tcp4Configure(), and Tcp6Configure().

#define SO_NO_MORE_DATA   0x0001

#define SO_UNCONFIGURED   0

Socket configure state

Referenced by SockDestroy(), SockDestroyChild(), and SockFlush().

#define SOCK_ABORT   10

Need to reset the protocol process.

Referenced by SockClose(), and TcpDispatcher().

#define SOCK_ATTACH   0

Attach current socket to a new PCB.

The request issued from socket layer to protocol layer.

Referenced by SockCreateChild(), and TcpDispatcher().

#define SOCK_BACKLOG   5

#define SOCK_BUFF_LOW_WATER   (2 * 1024)

Referenced by SockCreate().

#define SOCK_CLOSE   9

Need to close the protocol process.

Referenced by SockClose(), and TcpDispatcher().

#define SOCK_CONFIGURE   2

Configure attached PCB.

Referenced by SockConfigure(), and TcpDispatcher().

#define SOCK_CONNECT   8

Need to connect to a peer.

Referenced by SockConnect(), and TcpDispatcher().

#define SOCK_CONSUMED   7

Application has retrieved data from socket.

Referenced by SockRcv(), and TcpDispatcher().

#define SOCK_DETACH   1

Detach current socket from the PCB.

Referenced by SockDestroyChild(), and TcpDispatcher().

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

Set the socket with error state.

Parameters:
[in] Sock Pointer to the socket.
[in] Error The error state.

Referenced by SockFlush(), SockNoMoreData(), TcpConnectTimeout(), TcpIcmpInput(), TcpInput(), TcpKeepaliveTimeout(), and TcpRexmitTimeout().

#define SOCK_FLUSH   3

Flush attached PCB.

Referenced by SockFlush(), and TcpDispatcher().

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

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

#define SOCK_GROUP   14

Need to join a mcast group.

Referenced by SockGroup().

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

Check whether the socket is closed.

Parameters:
[in] Sock Pointer to the socket.
Return values:
TRUE The socket is closed.
FALSE The socket is not closed.

Referenced by SockConnect().

#define SOCK_IS_CONFIGURED ( Sock   ) 

Value:

(((Sock)->ConfigureState == SO_CONFIGURED_ACTIVE) || \
    ((Sock)->ConfigureState == SO_CONFIGURED_PASSIVE))
Check whether the socket is configured.

Parameters:
[in] Sock Pointer to the socket
Return values:
TRUE The socket is configued
FALSE The socket is not configued

Referenced by SockConfigure(), SockDestroyChild(), SockFlush(), Tcp4GetMode(), Tcp6GetMode(), and TcpFlushPcb().

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

Check whether the socket is configured to active mode.

Parameters:
[in] Sock Pointer to the socket.
Return values:
TRUE The socket is configued to active mode.
FALSE The socket is not configued to active mode.

Referenced by SockConnect().

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

Check whether the socket has connected.

Parameters:
[in] Sock Pointer to the socket.
Return values:
TRUE The socket has connected.
FALSE The socket has not connected.

Referenced by SockAccept(), SockRcv(), SockSend(), and SockWakeListenToken().

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

Check whether the socket is configured to passive mode.

Parameters:
[in] Sock Pointer to the socket.
Return values:
TRUE The socket is configued to passive mode.
FALSE The socket is not configued to passive mode.

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

Check whether the socket is connecting.

Parameters:
[in] Sock Pointer to the socket.
Return values:
TRUE The socket is connecting.
FALSE The socket is not connecting.

Referenced by SockRcv(), and SockSend().

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

Check whether the socket is disconnecting.

Parameters:
[in] Sock Pointer to the socket.
Return values:
TRUE The socket is disconnecting.
FALSE The socket is not disconnecting.

Referenced by SockClose().

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

Check whether the socket is listening.

Parameters:
[in] Sock Pointer to the socket.
Return values:
TRUE The socket is listening.
FALSE The socket is not listening.

Referenced by SockAccept(), SockConnFlush(), SockCreate(), and SockWakeListenToken().

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

Check whether the socket is mapped.

Parameters:
[in] Sock Pointer to the socket.
Return values:
TRUE The socket is not mapping.
FALSE The socket is mapped.

Referenced by SockAccept(), SockClose(), SockConnect(), SockRcv(), SockRoute(), and SockSend().

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

Check whether the socket is no more data.

Parameters:
[in] Sock Pointer to the socket.
Return values:
TRUE The socket is no more data.
FALSE The socket still has data.

Referenced by SockRcv().

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

Check whether the socket is unconfigured.

Parameters:
[in] Sock Pointer to the socket.
Return values:
TRUE The socket is unconfigued.
FALSE The socket is not unconfigued.

Referenced by SockAccept(), SockClose(), SockConnect(), SockDestroy(), SockGroup(), SockRcv(), SockRoute(), and SockSend().

#define SOCK_MODE   13

Need to get the mode data of the protocol.

Referenced by SockGetMode(), and TcpDispatcher().

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

Set socket SO_NO_MORE_DATA flag.

Parameters:
[in] Sock Pointer to the socket

Referenced by SockNoMoreData().

#define SOCK_POLL   11

Need to poll to the protocol layer.

Referenced by Tcp4Poll(), Tcp6Poll(), and TcpDispatcher().

#define SOCK_RCV_BUF   1

Referenced by SockGetFreeSpace(), and TcpRcvWinNow().

#define SOCK_RCV_BUFF_SIZE   (8 * 1024)

#define SOCK_ROUTE   12

Need to add a route information.

Referenced by SockRoute(), and TcpDispatcher().

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

#define SOCK_SND   4

Need protocol to send something.

Referenced by SockProcessTcpSndData(), and TcpDispatcher().

#define SOCK_SND_BUF   0

#define SOCK_SND_BUFF_SIZE   (8 * 1024)

#define SOCK_SNDPUSH   5

Need protocol to send pushed data.

Referenced by SockProcessTcpSndData(), and TcpDispatcher().

#define SOCK_SNDURG   6

Need protocol to send urgent data.

Referenced by SockProcessTcpSndData(), and TcpDispatcher().


Typedef Documentation

typedef union _NET_PROTOCOL NET_PROTOCOL

The union type of TCP and UDP protocol.

typedef struct _SOCK_BUFFER SOCK_BUFFER

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

Socket completion token

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

The Callback funtion called after the TCP socket is created.

Parameters:
[in] This Pointer to the socket just created.
[in] Context Context of the socket.
Return values:
EFI_SUCCESS This protocol installed successfully.
other Some error occured.

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] This The TCP socket to be destroyed.
[in] Context The context.

The initialize data for create a new socket.

typedef struct _SOCK_IO_TOKEN SOCK_IO_TOKEN

The application token with data packet

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] Socket The socket issuing the request to protocol.
[in] Request The request issued by socket.
[in] RequestData The request related data.
Return values:
EFI_SUCCESS The socket request is completed successfully.
other The error status returned by the corresponding TCP layer function.

typedef struct _SOCK_TOKEN SOCK_TOKEN

The token structure buffered in socket layer.

typedef struct _TCP_SOCKET SOCKET

typedef struct _TCP_RSV_DATA TCP_RSV_DATA

Reserved data to access the NET_BUF delivered by TCP driver.


Enumeration Type Documentation

enum SOCK_TYPE

The socket type.

Enumerator:
SockDgram  This socket providing datagram service.
SockStream  This socket providing stream service.


Function Documentation

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] Sock Pointer to the socket to accept connections.
[in] Token The token to accept a connection.
Return values:
EFI_SUCCESS Either a connection is accepted or the Token is buffered for further acceptance.
EFI_ACCESS_DENIED Failed 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_MAPPING The IP address configuration operation is not finished.
EFI_NOT_STARTED The socket is not configured.
EFI_OUT_OF_RESOURCE Failed 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] Sock Pointer to the socket to accept connections.
[in] Token The token to accept a connection.
Return values:
EFI_SUCCESS Either a connection is accpeted or the Token is buffered for further acception.
EFI_ACCESS_DENIED Failed 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_MAPPING The IP address configuration operation is not finished.
EFI_NOT_STARTED The socket is not configured.
EFI_OUT_OF_RESOURCE Failed to buffer the Token due to memory limits.

References _TCP_SOCKET::ConnCnt, _TCP_SOCKET::Parent, SIGNAL_TOKEN, SOCK_IS_CONNECTED, SOCK_IS_LISTENING, SOCK_IS_NO_MAPPING, SOCK_IS_UNCONFIGURED, SockBufferToken(), _TCP_SOCKET::SockHandle, SockStream, and SockTokenExisted().

Referenced by Tcp4Accept(), and Tcp6Accept().

SOCKET* SockClone ( IN SOCKET Sock  ) 

Clone a new socket including its associated protocol control block.

Parameters:
[in] Sock Pointer 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] Sock Pointer to the socket to be cloned.
Returns:
Pointer to the newly cloned socket. If NULL, an error condition occurred.

References _SOCK_INIT_DATA::BackLog, _TCP_SOCKET::ConfigureState, _SOCK_INIT_DATA::Context, _SOCK_INIT_DATA::CreateCallback, _SOCK_INIT_DATA::DataSize, _SOCK_INIT_DATA::DestroyCallback, _SOCK_INIT_DATA::DriverBinding, _SOCK_INIT_DATA::IpVersion, _SOCK_INIT_DATA::Parent, _SOCK_INIT_DATA::Protocol, _SOCK_INIT_DATA::ProtoData, _SOCK_INIT_DATA::ProtoHandler, _SOCK_INIT_DATA::RcvBufferSize, _SOCK_INIT_DATA::SndBufferSize, SO_CONNECTING, SockCreate(), SockSetState(), _SOCK_INIT_DATA::State, and _SOCK_INIT_DATA::Type.

Referenced by TcpCloneTcb().

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

Close or abort the socket associated connection.

Parameters:
[in,out] Sock Pointer to the socket of the connection to close or abort.
[in] Token The token for close operation.
[in] OnAbort TRUE for aborting the connection, FALSE to close it.
Return values:
EFI_SUCCESS The close or abort operation initialized successfully.
EFI_ACCESS_DENIED Failed 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_MAPPING The IP address configuration operation is not finished.
EFI_NOT_STARTED The socket is not configured.
Close or abort the socket associated connection.

Parameters:
[in,out] Sock Pointer to the socket of the connection to close or abort.
[in] Token The token for a close operation.
[in] OnAbort TRUE for aborting the connection; FALSE to close it.
Return values:
EFI_SUCCESS The close or abort operation initialized successfully.
EFI_ACCESS_DENIED Failed 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_MAPPING The IP address configuration operation is not finished.
EFI_NOT_STARTED The socket is not configured.

References SO_DISCONNECTING, SOCK_ABORT, SOCK_CLOSE, SOCK_IS_DISCONNECTING, SOCK_IS_NO_MAPPING, SOCK_IS_UNCONFIGURED, SockSetState(), SockStream, and SockTokenExisted().

Referenced by Tcp4Close(), and Tcp6Close().

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

Configure the specific socket Sock using configuration data ConfigData.

Parameters:
[in] Sock Pointer to the socket to be configured.
[in] ConfigData Pointer to the configuration data.
Return values:
EFI_SUCCESS The socket configured successfully.
EFI_ACCESS_DENIED Failed to get the lock to access the socket, or the socket is already configured.

References SO_CLOSED, SOCK_CONFIGURE, and SOCK_IS_CONFIGURED.

Referenced by Tcp4Configure(), and Tcp6Configure().

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] Sock Pointer 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] Sock Pointer to the socket associated with the closed connection.

References SIGNAL_TOKEN, SO_CLOSED, SockConnFlush(), SockDestroyChild(), and SockSetState().

Referenced by TcpSetState().

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

Initiate a connection establishment process.

Parameters:
[in] Sock Pointer to the socket to initiate the initate the connection.
[in] Token Pointer to the token used for the connection operation.
Return values:
EFI_SUCCESS The connection initialized successfully.
EFI_ACCESS_DENIED Failed 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_MAPPING The IP address configuration operation is not finished.
EFI_NOT_STARTED The socket is not configured.

References SO_CONNECTING, SOCK_CONNECT, SOCK_IS_CLOSED, SOCK_IS_CONFIGURED_ACTIVE, SOCK_IS_NO_MAPPING, SOCK_IS_UNCONFIGURED, SockSetState(), and SockTokenExisted().

Referenced by Tcp4Connect(), and Tcp6Connect().

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] Sock Pointer to the socket associated with the established connection.

References SO_CONNECTED, SO_CONNECTING, SockSetState(), SockWakeConnToken(), and SockWakeListenToken().

Referenced by TcpSetState().

SOCKET* SockCreateChild ( IN SOCK_INIT_DATA SockInitData  ) 

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

Parameters:
[in] SockInitData Inital data to setting the socket.
Returns:
Pointer to the newly created socket. If NULL, an error condition occured.

References _TCP_SOCKET::Lock, _TCP_SOCKET::ProtoHandler, SOCK_ATTACH, SockCreate(), and SockDestroy().

Referenced by TcpServiceBindingCreateChild().

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] Sock Pointer to the socket.
[in,out] NetBuffer Pointer to the buffer that contains the received data.
[in] UrgLen The 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] Sock Pointer to the socket.
[in,out] NetBuffer Pointer to the buffer that contains the received data.
[in] UrgLen The length of the urgent data in the received data.

References SockWakeRcvToken().

Referenced by TcpDeliverData().

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] Sock Pointer to the socket.
[in] Count The 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] Sock Pointer to the socket.
[in] Count The length of the data processed or sent, in bytes.

References _SOCK_TOKEN::RemainDataLen, SIGNAL_TOKEN, SockProcessSndToken(), _SOCK_TOKEN::Token, and _SOCK_TOKEN::TokenList.

Referenced by TcpGetSegmentSock().

EFI_STATUS SockDestroyChild ( IN OUT SOCKET Sock  ) 

Destroy the socket Sock and its associated protocol control block.

Parameters:
[in,out] Sock The socket to be destroyed.
Return values:
EFI_SUCCESS The socket Sock was destroyed successfully.
EFI_ACCESS_DENIED Failed to get the lock to access the socket.

References SO_CLOSED, SO_UNCONFIGURED, SOCK_DETACH, SOCK_IS_CONFIGURED, SockConnFlush(), SockDestroy(), and SockSetState().

Referenced by SockConnClosed(), SockConnFlush(), and TcpServiceBindingDestroyChild().

EFI_STATUS SockFlush ( IN OUT SOCKET Sock  ) 

Reset the socket and its associated protocol control block.

Parameters:
[in,out] Sock Pointer to the socket to be flushed.
Return values:
EFI_SUCCESS The socket flushed successfully.
EFI_ACCESS_DENIED Failed to get the lock to access the socket.
Reset the socket and its associated protocol control block.

Parameters:
[in,out] Sock Pointer to the socket to be flushed.
Return values:
EFI_SUCCESS The socket is flushed successfully.
EFI_ACCESS_DENIED Failed to get the lock to access the socket.

References SO_CLOSED, SO_UNCONFIGURED, SOCK_ERROR, SOCK_FLUSH, SOCK_IS_CONFIGURED, SockConnFlush(), SockSetState(), and SockStream.

Referenced by Tcp4Configure(), and Tcp6Configure().

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] Sock Pointer to the socket.
[in] Offset The start point of the data to be copied.
[in] Len The length of the data to be copied.
[out] Dest Pointer 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] Sock Pointer to the socket.
[in] Offset The start point of the data to be copied.
[in] Len The length of the data to be copied.
[out] Dest Pointer to the destination to copy the data.
Returns:
The data size copied.

References SockStream.

Referenced by TcpGetSegmentSock().

UINT32 SockGetFreeSpace ( IN SOCKET Sock,
IN UINT32  Which 
)

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

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

References _SOCK_BUFFER::DataQueue, _SOCK_BUFFER::HighWater, SOCK_RCV_BUF, and SOCK_SND_BUF.

Referenced by SockProcessSndToken(), SockSend(), and TcpRcvWinNow().

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

Get the mode data of the low layer protocol.

Parameters:
[in] Sock Pointer to the socket to get mode data from.
[in,out] Mode Pointer to the data to store the low layer mode information.
Return values:
EFI_SUCCESS The mode data was obtained successfully.
EFI_NOT_STARTED The socket is not configured.

References SOCK_MODE.

Referenced by Tcp4GetModeData(), and Tcp6GetModeData().

EFI_STATUS SockGroup ( IN SOCKET Sock,
IN VOID *  GroupInfo 
)

Configure the low level protocol to join a multicast group for this socket's connection.

Parameters:
[in] Sock Pointer to the socket of the connection to join the specific multicast group.
[in] GroupInfo Pointer to the multicast group information.
Return values:
EFI_SUCCESS The configuration completed successfully.
EFI_ACCESS_DENIED Failed to get the lock to access the socket.
EFI_NOT_STARTED The socket is not configured.
Configure the low level protocol to join a multicast group for this socket's connection.

Parameters:
[in] Sock Pointer to the socket of the connection to join the specific multicast group.
[in] GroupInfo Pointer to the multicast group info.
Return values:
EFI_SUCCESS The configuration completed successfully.
EFI_ACCESS_DENIED Failed to get the lock to access the socket.
EFI_NOT_STARTED The socket is not configured.

References SOCK_GROUP, and SOCK_IS_UNCONFIGURED.

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] Sock Pointer to the socket.

References GET_RCV_DATASIZE, SOCK_ERROR, SOCK_NO_MORE_DATA, and SockFlushPendingToken().

Referenced by TcpDeliverData().

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

Issue a token to get data from the socket.

Parameters:
[in] Sock Pointer to the socket to get data from.
[in] Token The token to store the received data from the socket.
Return values:
EFI_SUCCESS The token processed successfully.
EFI_ACCESS_DENIED Failed 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_MAPPING The IP address configuration operation is not finished.
EFI_NOT_STARTED The socket is not configured.
EFI_CONNECTION_FIN The connection is closed and there is no more data.
EFI_OUT_OF_RESOURCE Failed to buffer the token due to a memory limit.
Issue a token to get data from the socket.

Parameters:
[in] Sock Pointer to the socket to get data from.
[in] Token The token to store the received data from the socket.
Return values:
EFI_SUCCESS The token processed successfully.
EFI_ACCESS_DENIED Failed 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_MAPPING The IP address configuration operation is not finished.
EFI_NOT_STARTED The socket is not configured.
EFI_CONNECTION_FIN The connection is closed and there is no more data.
EFI_OUT_OF_RESOURCE Failed to buffer the token due to memory limit.

References _SOCK_COMPLETION_TOKEN::Event, GET_RCV_DATASIZE, SIGNAL_TOKEN, SOCK_CONSUMED, SOCK_IS_CONNECTED, SOCK_IS_CONNECTING, SOCK_IS_NO_MAPPING, SOCK_IS_NO_MORE_DATA, SOCK_IS_UNCONFIGURED, SockBufferToken(), SockProcessRcvToken(), SockStream, SockTokenExisted(), and _SOCK_IO_TOKEN::Token.

Referenced by Tcp4Receive(), and Tcp6Receive().

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

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

Parameters:
[in] Sock Pointer to the socket associated with the IP route table to operate on.
[in] RouteInfo Pointer to the route information to be processed.
Return values:
EFI_SUCCESS The route table updated successfully.
EFI_ACCESS_DENIED Failed to get the lock to access the socket.
EFI_NO_MAPPING The IP address configuration operation is not finished.
EFI_NOT_STARTED The socket is not configured.

References SOCK_IS_NO_MAPPING, SOCK_IS_UNCONFIGURED, and SOCK_ROUTE.

Referenced by Tcp4Routes().

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

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

Parameters:
[in] Sock Pointer to the socket to process the token with data.
[in] Token The token with data that needs to send out.
Return values:
EFI_SUCCESS The token processed successfully.
EFI_ACCESS_DENIED Failed 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_MAPPING The IP address configuration operation is not finished.
EFI_NOT_STARTED The socket is not configured.
EFI_OUT_OF_RESOURCE Failed to buffer the token due to a memory limit.
Issue a token with data to the socket to send out.

Parameters:
[in] Sock Pointer to the socket to process the token with data.
[in] Token The token with data that needs to send out.
Return values:
EFI_SUCCESS The token processed successfully.
EFI_ACCESS_DENIED Failed 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_MAPPING The IP address configuration operation is not finished.
EFI_NOT_STARTED The socket is not configured.
EFI_OUT_OF_RESOURCE Failed to buffer the token due to memory limits.

References _SOCK_COMPLETION_TOKEN::Event, _SOCK_IO_TOKEN::Packet, SOCK_IS_CONNECTED, SOCK_IS_CONNECTING, SOCK_IS_NO_MAPPING, SOCK_IS_UNCONFIGURED, SOCK_SND_BUF, SockBufferToken(), SockGetFreeSpace(), SockProcessTcpSndData(), SockStream, SockTokenExisted(), _SOCK_IO_TOKEN::Token, _SOCK_TOKEN::TokenList, and SOCK_IO_DATA::TxData.

Referenced by Tcp4Transmit(), and Tcp6Transmit().

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

Set the state of the socket.

Parameters:
[in,out] Sock Pointer to the socket.
[in] State The new socket state to be set.

Referenced by SockClone(), SockClose(), SockConnClosed(), SockConnect(), SockConnEstablished(), SockDestroy(), SockDestroyChild(), SockFlush(), and TcpConfigurePcb().


Generated on Mon Sep 28 08:49:06 2015 for NetworkPkg[ALL] by  doxygen 1.5.7.1