30#define SOCK_BUFF_LOW_WATER (2 * 1024)
31#define SOCK_RCV_BUFF_SIZE (8 * 1024)
32#define SOCK_SND_BUFF_SIZE (8 * 1024)
35#define PROTO_RESERVED_LEN 20
37#define SO_NO_MORE_DATA 0x0001
66#define SO_CONNECTING 2
68#define SO_DISCONNECTING 4
73#define SO_UNCONFIGURED 0
74#define SO_CONFIGURED_ACTIVE 1
75#define SO_CONFIGURED_PASSIVE 2
76#define SO_NO_MAPPING 3
83#define SOCK_CONFIGURE 2
88#define SOCK_CONSUMED 7
103#define SOCK_NO_MORE_DATA(Sock) ((Sock)->Flag |= SO_NO_MORE_DATA)
114#define SOCK_IS_UNCONFIGURED(Sock) ((Sock)->ConfigureState == SO_UNCONFIGURED)
125#define SOCK_IS_CONFIGURED(Sock) \
126 (((Sock)->ConfigureState == SO_CONFIGURED_ACTIVE) || \
127 ((Sock)->ConfigureState == SO_CONFIGURED_PASSIVE))
138#define SOCK_IS_CONFIGURED_ACTIVE(Sock) ((Sock)->ConfigureState == SO_CONFIGURED_ACTIVE)
149#define SOCK_IS_CONNECTED_PASSIVE(Sock) ((Sock)->ConfigureState == SO_CONFIGURED_PASSIVE)
160#define SOCK_IS_NO_MAPPING(Sock) ((Sock)->ConfigureState == SO_NO_MAPPING)
171#define SOCK_IS_CLOSED(Sock) ((Sock)->State == SO_CLOSED)
182#define SOCK_IS_LISTENING(Sock) ((Sock)->State == SO_LISTENING)
193#define SOCK_IS_CONNECTING(Sock) ((Sock)->State == SO_CONNECTING)
204#define SOCK_IS_CONNECTED(Sock) ((Sock)->State == SO_CONNECTED)
215#define SOCK_IS_DISCONNECTING(Sock) ((Sock)->State == SO_DISCONNECTING)
226#define SOCK_IS_NO_MORE_DATA(Sock) (0 != ((Sock)->Flag & SO_NO_MORE_DATA))
235#define SET_RCV_BUFFSIZE(Sock, Size) ((Sock)->RcvBuffer.HighWater = (Size))
245#define GET_RCV_BUFFSIZE(Sock) ((Sock)->RcvBuffer.HighWater)
255#define GET_RCV_DATASIZE(Sock) (((Sock)->RcvBuffer.DataQueue)->BufSize)
264#define SET_SND_BUFFSIZE(Sock, Size) ((Sock)->SndBuffer.HighWater = (Size))
274#define GET_SND_BUFFSIZE(Sock) ((Sock)->SndBuffer.HighWater)
284#define GET_SND_DATASIZE(Sock) (((Sock)->SndBuffer.DataQueue)->BufSize)
293#define SET_BACKLOG(Sock, Value) ((Sock)->BackLog = (Value))
303#define GET_BACKLOG(Sock) ((Sock)->BackLog)
312#define SOCK_ERROR(Sock, Error) ((Sock)->SockError = (Error))
314#define SOCK_SIGNATURE SIGNATURE_32 ('S', 'O', 'C', 'K')
316#define SOCK_FROM_THIS(a) CR ((a), SOCKET, NetProtocol, SOCK_SIGNATURE)
318#define SOCK_FROM_TOKEN(Token) (((SOCK_TOKEN *) (Token))->Sock)
320#define PROTO_TOKEN_FORM_SOCK(SockToken, Type) ((Type *) (((SOCK_TOKEN *) (SockToken))->Token))
466 UINT8 ConfigureState;
EFI_STATUS SockFlush(IN OUT SOCKET *Sock)
VOID SockDataRcvd(IN OUT SOCKET *Sock, IN OUT NET_BUF *NetBuffer, IN UINT32 UrgLen)
SOCKET * SockCreateChild(IN SOCK_INIT_DATA *SockInitData)
struct _TCP_RSV_DATA TCP_RSV_DATA
EFI_STATUS SockClose(IN OUT SOCKET *Sock, IN VOID *Token, IN BOOLEAN OnAbort)
struct _SOCK_IO_TOKEN SOCK_IO_TOKEN
EFI_STATUS SockConnect(IN SOCKET *Sock, IN VOID *Token)
EFI_STATUS(* SOCK_CREATE_CALLBACK)(IN SOCKET *This, IN VOID *Context)
struct _SOCK_COMPLETION_TOKEN SOCK_COMPLETION_TOKEN
EFI_STATUS SockRcv(IN SOCKET *Sock, IN VOID *Token)
struct _SOCK_INIT_DATA SOCK_INIT_DATA
UINT32 SockGetFreeSpace(IN SOCKET *Sock, IN UINT32 Which)
EFI_STATUS(* SOCK_PROTO_HANDLER)(IN SOCKET *Socket, IN UINT8 Request, IN VOID *RequestData)
@ SockDgram
This socket providing datagram service.
@ SockStream
This socket providing stream service.
VOID SockNoMoreData(IN OUT SOCKET *Sock)
SOCKET * SockClone(IN SOCKET *Sock)
UINT32 SockGetDataToSend(IN SOCKET *Sock, IN UINT32 Offset, IN UINT32 Len, OUT UINT8 *Dest)
VOID SockSetState(IN OUT SOCKET *Sock, IN UINT8 State)
struct _SOCK_TOKEN SOCK_TOKEN
union _NET_PROTOCOL NET_PROTOCOL
EFI_STATUS SockRoute(IN SOCKET *Sock, IN VOID *RouteInfo)
EFI_STATUS SockDestroyChild(IN OUT SOCKET *Sock)
EFI_STATUS SockSend(IN SOCKET *Sock, IN VOID *Token)
VOID SockConnClosed(IN OUT SOCKET *Sock)
EFI_STATUS SockAccept(IN SOCKET *Sock, IN VOID *Token)
struct _SOCK_BUFFER SOCK_BUFFER
VOID SockDataSent(IN OUT SOCKET *Sock, IN UINT32 Count)
EFI_STATUS SockGetMode(IN SOCKET *Sock, IN OUT VOID *Mode)
VOID SockConnEstablished(IN OUT SOCKET *Sock)
EFI_STATUS SockCancel(IN OUT SOCKET *Sock, IN VOID *Token)
VOID(* SOCK_DESTROY_CALLBACK)(IN SOCKET *This, IN VOID *Context)
EFI_STATUS SockConfigure(IN SOCKET *Sock, IN VOID *ConfigData)
NET_BUF_QUEUE * DataQueue
The queue to buffer data.
UINT32 LowWater
The low water mark of sock_buffer.
UINT32 HighWater
The buffersize upper limit of sock_buffer.
EFI_STATUS Status
The status to be issued.
EFI_EVENT Event
The event to be issued.
UINT32 SndBufferSize
The high water mark of send buffer.
SOCK_PROTO_HANDLER ProtoHandler
The handler of protocol for socket request.
SOCKET * Parent
The parent of this socket.
EFI_HANDLE DriverBinding
The driver binding handle.
VOID * Context
The context of the callback.
UINT32 BackLog
The connection limit for listening socket.
UINT32 RcvBufferSize
The high water mark of receive buffer.
SOCK_CREATE_CALLBACK CreateCallback
Callback after created.
SOCK_DESTROY_CALLBACK DestroyCallback
Callback before destroyed.
LIST_ENTRY TokenList
The entry to add in the token list.
SOCK_COMPLETION_TOKEN * Token
The application's token.
UINT32 RemainDataLen
Unprocessed data length.
SOCK_BUFFER RcvBuffer
Receive buffer of received data.
LIST_ENTRY ConnectionList
the connections maintained by this socket
UINT8 ProtoReserved[PROTO_RESERVED_LEN]
Data fields reserved for protocol.
SOCKET * Parent
listening parent that accept the connection
UINT32 Signature
Signature of the socket.
EFI_LOCK Lock
The lock of socket.
EFI_HANDLE SockHandle
The virtual handle of the socket.
EFI_STATUS SockError
The error returned by low layer protocol.
SOCK_COMPLETION_TOKEN * CloseToken
app's token to signal if closed
UINT32 BackLog
the limit of connection to this socket
SOCK_DESTROY_CALLBACK DestroyCallback
Callback before destroyed.
NET_PROTOCOL NetProtocol
TCP4 or TCP6 protocol socket used.
SOCK_PROTO_HANDLER ProtoHandler
The request handler of protocol.
EFI_HANDLE DriverBinding
Socket's driver binding protocol.
UINT32 ConnCnt
the current count of connections to it
SOCK_BUFFER SndBuffer
Send buffer of application's data.
SOCK_COMPLETION_TOKEN * ConnectionToken
app's token to signal if connected
SOCK_CREATE_CALLBACK CreateCallback
Callback after created.
VOID * Context
The context of the callback.
EFI_TCP4_PROTOCOL Tcp4Protocol
Tcp4 protocol.
EFI_TCP6_PROTOCOL Tcp6Protocol
Tcp6 protocol.