NetworkPkg/TcpDxe/SockImpl.c File Reference


Functions

NET_BUF * SockBufFirst (IN SOCK_BUFFER *Sockbuf)
NET_BUF * SockBufNext (IN SOCK_BUFFER *Sockbuf, IN NET_BUF *SockEntry)
VOID EFIAPI SockFreeFoo (IN EFI_EVENT Event)
UINT32 SockTcpDataToRcv (IN SOCK_BUFFER *SockBuffer, OUT BOOLEAN *IsUrg, IN UINT32 BufLen)
VOID SockSetTcpRxData (IN SOCKET *Sock, IN VOID *TcpRxData, IN UINT32 RcvdBytes, IN BOOLEAN IsUrg)
VOID SockProcessSndToken (IN OUT SOCKET *Sock)
UINT32 SockProcessRcvToken (IN OUT SOCKET *Sock, IN OUT SOCK_IO_TOKEN *RcvToken)
EFI_STATUS SockProcessTcpSndData (IN SOCKET *Sock, IN VOID *TcpTxData)
VOID SockFlushPendingToken (IN SOCKET *Sock, IN OUT LIST_ENTRY *PendingTokenList)
VOID SockWakeConnToken (IN OUT SOCKET *Sock)
VOID SockWakeListenToken (IN OUT SOCKET *Sock)
VOID SockWakeRcvToken (IN OUT SOCKET *Sock)
SOCKETSockCreate (IN SOCK_INIT_DATA *SockInitData)
VOID SockDestroy (IN OUT SOCKET *Sock)
VOID SockConnFlush (IN OUT SOCKET *Sock)
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)

Detailed Description

Implementation of the 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.


Function Documentation

NET_BUF* SockBufFirst ( IN SOCK_BUFFER Sockbuf  ) 

Get the first buffer block in the specific socket buffer.

Parameters:
[in] Sockbuf Pointer to the socket buffer.
Returns:
Pointer to the first buffer in the queue. NULL if the queue is empty.

Referenced by SockTcpDataToRcv().

NET_BUF* SockBufNext ( IN SOCK_BUFFER Sockbuf,
IN NET_BUF *  SockEntry 
)

Get the next buffer block in the specific socket buffer.

Parameters:
[in] Sockbuf Pointer to the socket buffer.
[in] SockEntry Pointer to the buffer block prior to the required one.
Returns:
Pointer to the buffer block next to SockEntry. NULL if SockEntry is the tail or head entry.

Referenced by SockTcpDataToRcv().

SOCKET* SockClone ( IN SOCKET Sock  ) 

VOID SockConnClosed ( IN OUT SOCKET Sock  ) 

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().

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().

VOID SockConnFlush ( IN OUT SOCKET Sock  ) 

Flush the sndBuffer and rcvBuffer of socket.

Parameters:
[in,out] Sock Pointer to the socket.

References SIGNAL_TOKEN, SOCK_IS_LISTENING, SockDestroyChild(), and SockFlushPendingToken().

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

SOCKET* SockCreate ( IN SOCK_INIT_DATA SockInitData  ) 

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 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 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().

VOID SockDestroy ( IN OUT SOCKET Sock  ) 

Destroy a socket.

Parameters:
[in,out] Sock Pointer to the socket.

References SO_CLOSED, SO_UNCONFIGURED, SOCK_IS_UNCONFIGURED, SockConnFlush(), SockSetState(), and SockStream.

Referenced by SockCreateChild(), and SockDestroyChild().

VOID SockFlushPendingToken ( IN SOCKET Sock,
IN OUT LIST_ENTRY *  PendingTokenList 
)

Flush the tokens in the specific token list.

Parameters:
[in] Sock Pointer to the socket.
[in,out] PendingTokenList Pointer to the token list to be flushed.

References SIGNAL_TOKEN, _SOCK_TOKEN::Token, and _SOCK_TOKEN::TokenList.

Referenced by SockConnFlush(), and SockNoMoreData().

VOID EFIAPI SockFreeFoo ( IN EFI_EVENT  Event  ) 

User provided callback function for NetbufFromExt.

Parameters:
[in] Event The Event this notify function registered to, ignored.

Referenced by SockProcessTcpSndData().

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 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().

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().

UINT32 SockProcessRcvToken ( IN OUT SOCKET Sock,
IN OUT SOCK_IO_TOKEN RcvToken 
)

Get received data from the socket layer to the receive token.

Parameters:
[in,out] Sock Pointer to the socket.
[in,out] RcvToken Pointer to the application provided receive token.
Returns:
The length of data received in this token.

References SIGNAL_TOKEN, SockSetTcpRxData(), SockStream, and SockTcpDataToRcv().

Referenced by SockRcv(), and SockWakeRcvToken().

VOID SockProcessSndToken ( IN OUT SOCKET Sock  ) 

Process the send token.

Parameters:
[in,out] Sock Pointer to the socket.

References _SOCK_IO_TOKEN::Packet, SIGNAL_TOKEN, SOCK_SND_BUF, SockGetFreeSpace(), SockProcessTcpSndData(), SockStream, _SOCK_TOKEN::Token, _SOCK_TOKEN::TokenList, and SOCK_IO_DATA::TxData.

Referenced by SockDataSent(), and SockWakeConnToken().

EFI_STATUS SockProcessTcpSndData ( IN SOCKET Sock,
IN VOID *  TcpTxData 
)

Process the TCP send data, buffer the tcp txdata, and append the buffer to socket send buffer, then try to send it.

Parameters:
[in] Sock Pointer to the socket.
[in] TcpTxData Pointer to the application provided send buffer.
Return values:
EFI_SUCCESS The operation completed successfully.
EFI_OUT_OF_RESOURCES Failed due to resource limits.

References SOCK_SND, SOCK_SNDPUSH, SOCK_SNDURG, and SockFreeFoo().

Referenced by SockProcessSndToken(), and SockSend().

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().

VOID SockSetTcpRxData ( IN SOCKET Sock,
IN VOID *  TcpRxData,
IN UINT32  RcvdBytes,
IN BOOLEAN  IsUrg 
)

Copy data from socket buffer to an application provided receive buffer.

Parameters:
[in] Sock Pointer to the socket.
[in] TcpRxData Pointer to the application provided receive buffer.
[in] RcvdBytes The maximum length of the data can be copied.
[in] IsUrg If TRUE the data is Out of Bound, FALSE the data is normal.

Referenced by SockProcessRcvToken().

UINT32 SockTcpDataToRcv ( IN SOCK_BUFFER SockBuffer,
OUT BOOLEAN *  IsUrg,
IN UINT32  BufLen 
)

Get the length of the data that can be retrieved from the socket receive buffer.

Parameters:
[in] SockBuffer Pointer to the socket receive buffer.
[out] IsUrg Pointer to a BOOLEAN variable. If TRUE the data is OOB.
[in] BufLen The maximum length of the data buffer to store the received data in the socket layer.
Returns:
The length of the data can be retreived.

References SockBufFirst(), SockBufNext(), and _TCP_RSV_DATA::UrgLen.

Referenced by SockProcessRcvToken().

VOID SockWakeConnToken ( IN OUT SOCKET Sock  ) 

Wake up the connection token while the connection is successfully established, then try to process any pending send token.

Parameters:
[in,out] Sock Pointer to the socket.

References SIGNAL_TOKEN, and SockProcessSndToken().

Referenced by SockConnEstablished().

VOID SockWakeListenToken ( IN OUT SOCKET Sock  ) 

Wake up the listen token while the connection is established successfully.

Parameters:
[in,out] Sock Pointer to the socket.

References _TCP_SOCKET::ConnCnt, _TCP_SOCKET::ListenTokenList, _TCP_SOCKET::Parent, SIGNAL_TOKEN, SOCK_IS_CONNECTED, SOCK_IS_LISTENING, _SOCK_TOKEN::Token, and _SOCK_TOKEN::TokenList.

Referenced by SockConnEstablished().

VOID SockWakeRcvToken ( IN OUT SOCKET Sock  ) 

Wake up the receive token while some data is received.

Parameters:
[in,out] Sock Pointer to the socket.

References SockProcessRcvToken(), _SOCK_TOKEN::Token, and _SOCK_TOKEN::TokenList.

Referenced by SockDataRcvd().


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