NetworkPkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the NetworkPkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
This commit is contained in:
committed by
mergify[bot]
parent
2f88bd3a12
commit
d1050b9dff
@@ -138,7 +138,7 @@ TcpComponentNameGetControllerName (
|
||||
///
|
||||
/// EFI Component Name Protocol
|
||||
///
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gTcpComponentName = {
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gTcpComponentName = {
|
||||
TcpComponentNameGetDriverName,
|
||||
TcpComponentNameGetControllerName,
|
||||
"eng"
|
||||
@@ -147,13 +147,13 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gTcpComponentName
|
||||
///
|
||||
/// EFI Component Name 2 Protocol
|
||||
///
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gTcpComponentName2 = {
|
||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) TcpComponentNameGetDriverName,
|
||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) TcpComponentNameGetControllerName,
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gTcpComponentName2 = {
|
||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME)TcpComponentNameGetDriverName,
|
||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)TcpComponentNameGetControllerName,
|
||||
"en"
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mTcpDriverNameTable[] = {
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mTcpDriverNameTable[] = {
|
||||
{
|
||||
"eng;en",
|
||||
L"TCP Network Service Driver"
|
||||
@@ -164,7 +164,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mTcpDriverNameTabl
|
||||
}
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE *gTcpControllerNameTable = NULL;
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE *gTcpControllerNameTable = NULL;
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user-readable name of the driver.
|
||||
@@ -216,7 +216,7 @@ TcpComponentNameGetDriverName (
|
||||
This->SupportedLanguages,
|
||||
mTcpDriverNameTable,
|
||||
DriverName,
|
||||
(BOOLEAN) (This == &gTcpComponentName)
|
||||
(BOOLEAN)(This == &gTcpComponentName)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -232,12 +232,12 @@ TcpComponentNameGetDriverName (
|
||||
**/
|
||||
EFI_STATUS
|
||||
UpdateTcp4Name (
|
||||
IN EFI_TCP4_PROTOCOL *Tcp4
|
||||
IN EFI_TCP4_PROTOCOL *Tcp4
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
CHAR16 HandleName[80];
|
||||
EFI_TCP4_CONFIG_DATA Tcp4ConfigData;
|
||||
EFI_STATUS Status;
|
||||
CHAR16 HandleName[80];
|
||||
EFI_TCP4_CONFIG_DATA Tcp4ConfigData;
|
||||
|
||||
if (Tcp4 == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
@@ -250,7 +250,9 @@ UpdateTcp4Name (
|
||||
ZeroMem (&Tcp4ConfigData, sizeof (Tcp4ConfigData));
|
||||
Status = Tcp4->GetModeData (Tcp4, NULL, &Tcp4ConfigData, NULL, NULL, NULL);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
UnicodeSPrint (HandleName, sizeof (HandleName),
|
||||
UnicodeSPrint (
|
||||
HandleName,
|
||||
sizeof (HandleName),
|
||||
L"TCPv4 (SrcPort=%d, DestPort=%d, ActiveFlag=%s)",
|
||||
Tcp4ConfigData.AccessPoint.StationPort,
|
||||
Tcp4ConfigData.AccessPoint.RemotePort,
|
||||
@@ -303,12 +305,12 @@ UpdateTcp4Name (
|
||||
**/
|
||||
EFI_STATUS
|
||||
UpdateTcp6Name (
|
||||
IN EFI_TCP6_PROTOCOL *Tcp6
|
||||
IN EFI_TCP6_PROTOCOL *Tcp6
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
CHAR16 HandleName[80];
|
||||
EFI_TCP6_CONFIG_DATA Tcp6ConfigData;
|
||||
EFI_STATUS Status;
|
||||
CHAR16 HandleName[80];
|
||||
EFI_TCP6_CONFIG_DATA Tcp6ConfigData;
|
||||
|
||||
if (Tcp6 == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
@@ -320,7 +322,9 @@ UpdateTcp6Name (
|
||||
ZeroMem (&Tcp6ConfigData, sizeof (Tcp6ConfigData));
|
||||
Status = Tcp6->GetModeData (Tcp6, NULL, &Tcp6ConfigData, NULL, NULL, NULL);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
UnicodeSPrint (HandleName, sizeof (HandleName),
|
||||
UnicodeSPrint (
|
||||
HandleName,
|
||||
sizeof (HandleName),
|
||||
L"TCPv6(SrcPort=%d, DestPort=%d, ActiveFlag=%d)",
|
||||
Tcp6ConfigData.AccessPoint.StationPort,
|
||||
Tcp6ConfigData.AccessPoint.RemotePort,
|
||||
@@ -332,7 +336,6 @@ UpdateTcp6Name (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
if (gTcpControllerNameTable != NULL) {
|
||||
FreeUnicodeStringTable (gTcpControllerNameTable);
|
||||
gTcpControllerNameTable = NULL;
|
||||
@@ -434,9 +437,9 @@ TcpComponentNameGetControllerName (
|
||||
OUT CHAR16 **ControllerName
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_TCP4_PROTOCOL *Tcp4;
|
||||
EFI_TCP6_PROTOCOL *Tcp6;
|
||||
EFI_STATUS Status;
|
||||
EFI_TCP4_PROTOCOL *Tcp4;
|
||||
EFI_TCP6_PROTOCOL *Tcp6;
|
||||
|
||||
//
|
||||
// Only provide names for child handles.
|
||||
@@ -460,7 +463,7 @@ TcpComponentNameGetControllerName (
|
||||
Status = gBS->OpenProtocol (
|
||||
ChildHandle,
|
||||
&gEfiTcp6ProtocolGuid,
|
||||
(VOID **)&Tcp6,
|
||||
(VOID **)&Tcp6,
|
||||
NULL,
|
||||
NULL,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
@@ -491,13 +494,13 @@ TcpComponentNameGetControllerName (
|
||||
// Retrieve an instance of a produced protocol from ChildHandle
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
ChildHandle,
|
||||
&gEfiTcp4ProtocolGuid,
|
||||
(VOID **)&Tcp4,
|
||||
NULL,
|
||||
NULL,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
);
|
||||
ChildHandle,
|
||||
&gEfiTcp4ProtocolGuid,
|
||||
(VOID **)&Tcp4,
|
||||
NULL,
|
||||
NULL,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
@@ -519,4 +522,3 @@ TcpComponentNameGetControllerName (
|
||||
(BOOLEAN)(This == &gTcpComponentName)
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
**/
|
||||
NET_BUF *
|
||||
SockBufFirst (
|
||||
IN SOCK_BUFFER *Sockbuf
|
||||
IN SOCK_BUFFER *Sockbuf
|
||||
)
|
||||
{
|
||||
LIST_ENTRY *NetbufList;
|
||||
@@ -45,8 +45,8 @@ SockBufFirst (
|
||||
**/
|
||||
NET_BUF *
|
||||
SockBufNext (
|
||||
IN SOCK_BUFFER *Sockbuf,
|
||||
IN NET_BUF *SockEntry
|
||||
IN SOCK_BUFFER *Sockbuf,
|
||||
IN NET_BUF *SockEntry
|
||||
)
|
||||
{
|
||||
LIST_ENTRY *NetbufList;
|
||||
@@ -56,8 +56,8 @@ SockBufNext (
|
||||
if ((SockEntry->List.ForwardLink == NetbufList) ||
|
||||
(SockEntry->List.BackLink == &SockEntry->List) ||
|
||||
(SockEntry->List.ForwardLink == &SockEntry->List)
|
||||
) {
|
||||
|
||||
)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ SockBufNext (
|
||||
VOID
|
||||
EFIAPI
|
||||
SockFreeFoo (
|
||||
IN VOID *Arg
|
||||
IN VOID *Arg
|
||||
)
|
||||
{
|
||||
return;
|
||||
@@ -94,9 +94,9 @@ SockFreeFoo (
|
||||
**/
|
||||
UINT32
|
||||
SockTcpDataToRcv (
|
||||
IN SOCK_BUFFER *SockBuffer,
|
||||
OUT BOOLEAN *IsUrg,
|
||||
IN UINT32 BufLen
|
||||
IN SOCK_BUFFER *SockBuffer,
|
||||
OUT BOOLEAN *IsUrg,
|
||||
IN UINT32 BufLen
|
||||
)
|
||||
{
|
||||
NET_BUF *RcvBufEntry;
|
||||
@@ -112,16 +112,15 @@ SockTcpDataToRcv (
|
||||
RcvBufEntry = SockBufFirst (SockBuffer);
|
||||
ASSERT (RcvBufEntry != NULL);
|
||||
|
||||
TcpRsvData = (TCP_RSV_DATA *) RcvBufEntry->ProtoData;
|
||||
TcpRsvData = (TCP_RSV_DATA *)RcvBufEntry->ProtoData;
|
||||
|
||||
//
|
||||
// Check whether the receive data is out of bound. If yes, calculate the maximum
|
||||
// allowed length of the urgent data and output it.
|
||||
//
|
||||
*IsUrg = (BOOLEAN) ((TcpRsvData->UrgLen > 0) ? TRUE : FALSE);
|
||||
*IsUrg = (BOOLEAN)((TcpRsvData->UrgLen > 0) ? TRUE : FALSE);
|
||||
|
||||
if (*IsUrg && (TcpRsvData->UrgLen < RcvBufEntry->TotalSize)) {
|
||||
|
||||
DataLen = MIN (TcpRsvData->UrgLen, BufLen);
|
||||
|
||||
if (DataLen < TcpRsvData->UrgLen) {
|
||||
@@ -131,29 +130,26 @@ SockTcpDataToRcv (
|
||||
}
|
||||
|
||||
return DataLen;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Process the next socket receive buffer to get the maximum allowed length
|
||||
// of the received data.
|
||||
//
|
||||
DataLen = RcvBufEntry->TotalSize;
|
||||
DataLen = RcvBufEntry->TotalSize;
|
||||
|
||||
RcvBufEntry = SockBufNext (SockBuffer, RcvBufEntry);
|
||||
|
||||
while ((BufLen > DataLen) && (RcvBufEntry != NULL)) {
|
||||
TcpRsvData = (TCP_RSV_DATA *)RcvBufEntry->ProtoData;
|
||||
|
||||
TcpRsvData = (TCP_RSV_DATA *) RcvBufEntry->ProtoData;
|
||||
|
||||
Urg = (BOOLEAN) ((TcpRsvData->UrgLen > 0) ? TRUE : FALSE);
|
||||
Urg = (BOOLEAN)((TcpRsvData->UrgLen > 0) ? TRUE : FALSE);
|
||||
|
||||
if (*IsUrg != Urg) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (*IsUrg && TcpRsvData->UrgLen < RcvBufEntry->TotalSize) {
|
||||
|
||||
if (*IsUrg && (TcpRsvData->UrgLen < RcvBufEntry->TotalSize)) {
|
||||
if (TcpRsvData->UrgLen + DataLen < BufLen) {
|
||||
TcpRsvData->UrgLen = 0;
|
||||
} else {
|
||||
@@ -161,7 +157,6 @@ SockTcpDataToRcv (
|
||||
}
|
||||
|
||||
return MIN (TcpRsvData->UrgLen + DataLen, BufLen);
|
||||
|
||||
}
|
||||
|
||||
DataLen += RcvBufEntry->TotalSize;
|
||||
@@ -184,10 +179,10 @@ SockTcpDataToRcv (
|
||||
**/
|
||||
VOID
|
||||
SockSetTcpRxData (
|
||||
IN SOCKET *Sock,
|
||||
IN VOID *TcpRxData,
|
||||
IN UINT32 RcvdBytes,
|
||||
IN BOOLEAN IsUrg
|
||||
IN SOCKET *Sock,
|
||||
IN VOID *TcpRxData,
|
||||
IN UINT32 RcvdBytes,
|
||||
IN BOOLEAN IsUrg
|
||||
)
|
||||
{
|
||||
UINT32 Index;
|
||||
@@ -196,22 +191,21 @@ SockSetTcpRxData (
|
||||
EFI_TCP4_RECEIVE_DATA *RxData;
|
||||
EFI_TCP4_FRAGMENT_DATA *Fragment;
|
||||
|
||||
RxData = (EFI_TCP4_RECEIVE_DATA *) TcpRxData;
|
||||
RxData = (EFI_TCP4_RECEIVE_DATA *)TcpRxData;
|
||||
|
||||
OffSet = 0;
|
||||
OffSet = 0;
|
||||
|
||||
ASSERT (RxData->DataLength >= RcvdBytes);
|
||||
|
||||
RxData->DataLength = RcvdBytes;
|
||||
RxData->UrgentFlag = IsUrg;
|
||||
RxData->DataLength = RcvdBytes;
|
||||
RxData->UrgentFlag = IsUrg;
|
||||
|
||||
//
|
||||
// Copy the CopyBytes data from socket receive buffer to RxData.
|
||||
//
|
||||
for (Index = 0; (Index < RxData->FragmentCount) && (RcvdBytes > 0); Index++) {
|
||||
|
||||
Fragment = &RxData->FragmentTable[Index];
|
||||
CopyBytes = MIN ((UINT32) (Fragment->FragmentLength), RcvdBytes);
|
||||
CopyBytes = MIN ((UINT32)(Fragment->FragmentLength), RcvdBytes);
|
||||
|
||||
NetbufQueCopy (
|
||||
Sock->RcvBuffer.DataQueue,
|
||||
@@ -221,8 +215,8 @@ SockSetTcpRxData (
|
||||
);
|
||||
|
||||
Fragment->FragmentLength = CopyBytes;
|
||||
RcvdBytes -= CopyBytes;
|
||||
OffSet += CopyBytes;
|
||||
RcvdBytes -= CopyBytes;
|
||||
OffSet += CopyBytes;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,7 +228,7 @@ SockSetTcpRxData (
|
||||
**/
|
||||
VOID
|
||||
SockProcessSndToken (
|
||||
IN OUT SOCKET *Sock
|
||||
IN OUT SOCKET *Sock
|
||||
)
|
||||
{
|
||||
UINT32 FreeSpace;
|
||||
@@ -253,7 +247,6 @@ SockProcessSndToken (
|
||||
// socket layer flow control policy
|
||||
//
|
||||
while ((FreeSpace >= Sock->SndBuffer.LowWater) && !IsListEmpty (&Sock->SndTokenList)) {
|
||||
|
||||
SockToken = NET_LIST_HEAD (
|
||||
&(Sock->SndTokenList),
|
||||
SOCK_TOKEN,
|
||||
@@ -272,11 +265,11 @@ SockProcessSndToken (
|
||||
//
|
||||
// Process it in the light of SockType
|
||||
//
|
||||
SndToken = (SOCK_IO_TOKEN *) SockToken->Token;
|
||||
TxData = SndToken->Packet.TxData;
|
||||
SndToken = (SOCK_IO_TOKEN *)SockToken->Token;
|
||||
TxData = SndToken->Packet.TxData;
|
||||
|
||||
DataLen = TxData->DataLength;
|
||||
Status = SockProcessTcpSndData (Sock, TxData);
|
||||
DataLen = TxData->DataLength;
|
||||
Status = SockProcessTcpSndData (Sock, TxData);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto OnError;
|
||||
@@ -284,10 +277,8 @@ SockProcessSndToken (
|
||||
|
||||
if (DataLen >= FreeSpace) {
|
||||
FreeSpace = 0;
|
||||
|
||||
} else {
|
||||
FreeSpace -= DataLen;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,13 +302,13 @@ OnError:
|
||||
**/
|
||||
UINT32
|
||||
SockProcessRcvToken (
|
||||
IN OUT SOCKET *Sock,
|
||||
IN OUT SOCK_IO_TOKEN *RcvToken
|
||||
IN OUT SOCKET *Sock,
|
||||
IN OUT SOCK_IO_TOKEN *RcvToken
|
||||
)
|
||||
{
|
||||
UINT32 TokenRcvdBytes;
|
||||
EFI_TCP4_RECEIVE_DATA *RxData;
|
||||
BOOLEAN IsUrg;
|
||||
UINT32 TokenRcvdBytes;
|
||||
EFI_TCP4_RECEIVE_DATA *RxData;
|
||||
BOOLEAN IsUrg;
|
||||
|
||||
ASSERT (Sock != NULL);
|
||||
|
||||
@@ -356,22 +347,22 @@ SockProcessRcvToken (
|
||||
**/
|
||||
EFI_STATUS
|
||||
SockProcessTcpSndData (
|
||||
IN SOCKET *Sock,
|
||||
IN VOID *TcpTxData
|
||||
IN SOCKET *Sock,
|
||||
IN VOID *TcpTxData
|
||||
)
|
||||
{
|
||||
NET_BUF *SndData;
|
||||
EFI_STATUS Status;
|
||||
EFI_TCP4_TRANSMIT_DATA *TxData;
|
||||
|
||||
TxData = (EFI_TCP4_TRANSMIT_DATA *) TcpTxData;
|
||||
TxData = (EFI_TCP4_TRANSMIT_DATA *)TcpTxData;
|
||||
|
||||
//
|
||||
// transform this TxData into a NET_BUFFER
|
||||
// and insert it into Sock->SndBuffer
|
||||
//
|
||||
SndData = NetbufFromExt (
|
||||
(NET_FRAGMENT *) TxData->FragmentTable,
|
||||
(NET_FRAGMENT *)TxData->FragmentTable,
|
||||
TxData->FragmentCount,
|
||||
0,
|
||||
0,
|
||||
@@ -382,7 +373,7 @@ SockProcessTcpSndData (
|
||||
if (NULL == SndData) {
|
||||
DEBUG (
|
||||
(DEBUG_ERROR,
|
||||
"SockKProcessSndData: Failed to call NetBufferFromExt\n")
|
||||
"SockKProcessSndData: Failed to call NetBufferFromExt\n")
|
||||
);
|
||||
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
@@ -431,12 +422,12 @@ SockProcessTcpSndData (
|
||||
**/
|
||||
VOID
|
||||
SockFlushPendingToken (
|
||||
IN SOCKET *Sock,
|
||||
IN OUT LIST_ENTRY *PendingTokenList
|
||||
IN SOCKET *Sock,
|
||||
IN OUT LIST_ENTRY *PendingTokenList
|
||||
)
|
||||
{
|
||||
SOCK_TOKEN *SockToken;
|
||||
SOCK_COMPLETION_TOKEN *Token;
|
||||
SOCK_TOKEN *SockToken;
|
||||
SOCK_COMPLETION_TOKEN *Token;
|
||||
|
||||
ASSERT ((Sock != NULL) && (PendingTokenList != NULL));
|
||||
|
||||
@@ -464,7 +455,7 @@ SockFlushPendingToken (
|
||||
**/
|
||||
VOID
|
||||
SockWakeConnToken (
|
||||
IN OUT SOCKET *Sock
|
||||
IN OUT SOCKET *Sock
|
||||
)
|
||||
{
|
||||
ASSERT (Sock->ConnectionToken != NULL);
|
||||
@@ -486,12 +477,12 @@ SockWakeConnToken (
|
||||
**/
|
||||
VOID
|
||||
SockWakeListenToken (
|
||||
IN OUT SOCKET *Sock
|
||||
IN OUT SOCKET *Sock
|
||||
)
|
||||
{
|
||||
SOCKET *Parent;
|
||||
SOCK_TOKEN *SockToken;
|
||||
EFI_TCP4_LISTEN_TOKEN *ListenToken;
|
||||
SOCKET *Parent;
|
||||
SOCK_TOKEN *SockToken;
|
||||
EFI_TCP4_LISTEN_TOKEN *ListenToken;
|
||||
|
||||
Parent = Sock->Parent;
|
||||
|
||||
@@ -504,7 +495,7 @@ SockWakeListenToken (
|
||||
TokenList
|
||||
);
|
||||
|
||||
ListenToken = (EFI_TCP4_LISTEN_TOKEN *) SockToken->Token;
|
||||
ListenToken = (EFI_TCP4_LISTEN_TOKEN *)SockToken->Token;
|
||||
ListenToken->NewChildHandle = Sock->SockHandle;
|
||||
|
||||
SIGNAL_TOKEN (&(ListenToken->CompletionToken), EFI_SUCCESS);
|
||||
@@ -517,8 +508,8 @@ SockWakeListenToken (
|
||||
Parent->ConnCnt--;
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"SockWakeListenToken: accept a socket, now conncnt is %d",
|
||||
Parent->ConnCnt)
|
||||
"SockWakeListenToken: accept a socket, now conncnt is %d",
|
||||
Parent->ConnCnt)
|
||||
);
|
||||
|
||||
Sock->Parent = NULL;
|
||||
@@ -533,13 +524,13 @@ SockWakeListenToken (
|
||||
**/
|
||||
VOID
|
||||
SockWakeRcvToken (
|
||||
IN OUT SOCKET *Sock
|
||||
IN OUT SOCKET *Sock
|
||||
)
|
||||
{
|
||||
UINT32 RcvdBytes;
|
||||
UINT32 TokenRcvdBytes;
|
||||
SOCK_TOKEN *SockToken;
|
||||
SOCK_IO_TOKEN *RcvToken;
|
||||
UINT32 RcvdBytes;
|
||||
UINT32 TokenRcvdBytes;
|
||||
SOCK_TOKEN *SockToken;
|
||||
SOCK_IO_TOKEN *RcvToken;
|
||||
|
||||
ASSERT (Sock->RcvBuffer.DataQueue != NULL);
|
||||
|
||||
@@ -548,18 +539,17 @@ SockWakeRcvToken (
|
||||
ASSERT (RcvdBytes > 0);
|
||||
|
||||
while (RcvdBytes > 0 && !IsListEmpty (&Sock->RcvTokenList)) {
|
||||
|
||||
SockToken = NET_LIST_HEAD (
|
||||
&Sock->RcvTokenList,
|
||||
SOCK_TOKEN,
|
||||
TokenList
|
||||
);
|
||||
|
||||
RcvToken = (SOCK_IO_TOKEN *) SockToken->Token;
|
||||
TokenRcvdBytes = SockProcessRcvToken (Sock, RcvToken);
|
||||
RcvToken = (SOCK_IO_TOKEN *)SockToken->Token;
|
||||
TokenRcvdBytes = SockProcessRcvToken (Sock, RcvToken);
|
||||
|
||||
if (0 == TokenRcvdBytes) {
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
RemoveEntryList (&(SockToken->TokenList));
|
||||
@@ -585,15 +575,15 @@ SockCancelToken (
|
||||
IN OUT LIST_ENTRY *SpecifiedTokenList
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Entry;
|
||||
SOCK_TOKEN *SockToken;
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Entry;
|
||||
SOCK_TOKEN *SockToken;
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
Entry = NULL;
|
||||
SockToken = NULL;
|
||||
|
||||
if (IsListEmpty (SpecifiedTokenList) && Token != NULL) {
|
||||
if (IsListEmpty (SpecifiedTokenList) && (Token != NULL)) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
@@ -609,10 +599,10 @@ SockCancelToken (
|
||||
RemoveEntryList (&SockToken->TokenList);
|
||||
FreePool (SockToken);
|
||||
|
||||
Entry = SpecifiedTokenList->ForwardLink;
|
||||
Entry = SpecifiedTokenList->ForwardLink;
|
||||
Status = EFI_SUCCESS;
|
||||
} else {
|
||||
if (Token == (VOID *) SockToken->Token) {
|
||||
if (Token == (VOID *)SockToken->Token) {
|
||||
SIGNAL_TOKEN (Token, EFI_ABORTED);
|
||||
RemoveEntryList (&(SockToken->TokenList));
|
||||
FreePool (SockToken);
|
||||
@@ -641,7 +631,7 @@ SockCancelToken (
|
||||
**/
|
||||
SOCKET *
|
||||
SockCreate (
|
||||
IN SOCK_INIT_DATA *SockInitData
|
||||
IN SOCK_INIT_DATA *SockInitData
|
||||
)
|
||||
{
|
||||
SOCKET *Sock;
|
||||
@@ -662,15 +652,14 @@ SockCreate (
|
||||
ProtocolLength = sizeof (EFI_TCP6_PROTOCOL);
|
||||
}
|
||||
|
||||
|
||||
Parent = SockInitData->Parent;
|
||||
|
||||
if ((Parent != NULL) && (Parent->ConnCnt == Parent->BackLog)) {
|
||||
DEBUG (
|
||||
(DEBUG_ERROR,
|
||||
"SockCreate: Socket parent has reached its connection limit with %d ConnCnt and %d BackLog\n",
|
||||
Parent->ConnCnt,
|
||||
Parent->BackLog)
|
||||
"SockCreate: Socket parent has reached its connection limit with %d ConnCnt and %d BackLog\n",
|
||||
Parent->ConnCnt,
|
||||
Parent->BackLog)
|
||||
);
|
||||
|
||||
return NULL;
|
||||
@@ -678,7 +667,6 @@ SockCreate (
|
||||
|
||||
Sock = AllocateZeroPool (sizeof (SOCKET));
|
||||
if (NULL == Sock) {
|
||||
|
||||
DEBUG ((DEBUG_ERROR, "SockCreate: No resource to create a new socket\n"));
|
||||
return NULL;
|
||||
}
|
||||
@@ -696,7 +684,7 @@ SockCreate (
|
||||
if (NULL == Sock->SndBuffer.DataQueue) {
|
||||
DEBUG (
|
||||
(DEBUG_ERROR,
|
||||
"SockCreate: No resource to allocate SndBuffer for new socket\n")
|
||||
"SockCreate: No resource to allocate SndBuffer for new socket\n")
|
||||
);
|
||||
|
||||
goto OnError;
|
||||
@@ -706,13 +694,13 @@ SockCreate (
|
||||
if (NULL == Sock->RcvBuffer.DataQueue) {
|
||||
DEBUG (
|
||||
(DEBUG_ERROR,
|
||||
"SockCreate: No resource to allocate RcvBuffer for new socket\n")
|
||||
"SockCreate: No resource to allocate RcvBuffer for new socket\n")
|
||||
);
|
||||
|
||||
goto OnError;
|
||||
}
|
||||
|
||||
Sock->Signature = SOCK_SIGNATURE;
|
||||
Sock->Signature = SOCK_SIGNATURE;
|
||||
|
||||
Sock->Parent = Parent;
|
||||
Sock->BackLog = SockInitData->BackLog;
|
||||
@@ -726,11 +714,11 @@ SockCreate (
|
||||
Sock->DestroyCallback = SockInitData->DestroyCallback;
|
||||
Sock->Context = SockInitData->Context;
|
||||
|
||||
Sock->SockError = EFI_ABORTED;
|
||||
Sock->SndBuffer.LowWater = SOCK_BUFF_LOW_WATER;
|
||||
Sock->RcvBuffer.LowWater = SOCK_BUFF_LOW_WATER;
|
||||
Sock->SockError = EFI_ABORTED;
|
||||
Sock->SndBuffer.LowWater = SOCK_BUFF_LOW_WATER;
|
||||
Sock->RcvBuffer.LowWater = SOCK_BUFF_LOW_WATER;
|
||||
|
||||
Sock->IpVersion = SockInitData->IpVersion;
|
||||
Sock->IpVersion = SockInitData->IpVersion;
|
||||
|
||||
//
|
||||
// Install protocol on Sock->SockHandle
|
||||
@@ -752,8 +740,8 @@ SockCreate (
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG (
|
||||
(DEBUG_ERROR,
|
||||
"SockCreate: Install TCP protocol in socket failed with %r\n",
|
||||
Status)
|
||||
"SockCreate: Install TCP protocol in socket failed with %r\n",
|
||||
Status)
|
||||
);
|
||||
|
||||
goto OnError;
|
||||
@@ -771,8 +759,8 @@ SockCreate (
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"SockCreate: Create a new socket and add to parent, now conncnt is %d\n",
|
||||
Parent->ConnCnt)
|
||||
"SockCreate: Create a new socket and add to parent, now conncnt is %d\n",
|
||||
Parent->ConnCnt)
|
||||
);
|
||||
|
||||
InsertTailList (&Parent->ConnectionList, &Sock->ConnectionList);
|
||||
@@ -819,7 +807,7 @@ OnError:
|
||||
**/
|
||||
VOID
|
||||
SockDestroy (
|
||||
IN OUT SOCKET *Sock
|
||||
IN OUT SOCKET *Sock
|
||||
)
|
||||
{
|
||||
ASSERT (SockStream == Sock->Type);
|
||||
@@ -829,12 +817,11 @@ SockDestroy (
|
||||
// by sock and rcv, snd buffer
|
||||
//
|
||||
if (!SOCK_IS_UNCONFIGURED (Sock)) {
|
||||
|
||||
SockConnFlush (Sock);
|
||||
SockSetState (Sock, SO_CLOSED);
|
||||
Sock->ConfigureState = SO_UNCONFIGURED;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Destroy the RcvBuffer Queue and SendBuffer Queue
|
||||
//
|
||||
@@ -845,14 +832,13 @@ SockDestroy (
|
||||
// Remove it from parent connection list if needed
|
||||
//
|
||||
if (Sock->Parent != NULL) {
|
||||
|
||||
RemoveEntryList (&(Sock->ConnectionList));
|
||||
(Sock->Parent->ConnCnt)--;
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_WARN,
|
||||
"SockDestroy: Delete a unaccepted socket from parent now conncnt is %d\n",
|
||||
Sock->Parent->ConnCnt)
|
||||
"SockDestroy: Delete a unaccepted socket from parent now conncnt is %d\n",
|
||||
Sock->Parent->ConnCnt)
|
||||
);
|
||||
|
||||
Sock->Parent = NULL;
|
||||
@@ -869,7 +855,7 @@ SockDestroy (
|
||||
**/
|
||||
VOID
|
||||
SockConnFlush (
|
||||
IN OUT SOCKET *Sock
|
||||
IN OUT SOCKET *Sock
|
||||
)
|
||||
{
|
||||
SOCKET *Child;
|
||||
@@ -921,7 +907,6 @@ SockConnFlush (
|
||||
|
||||
Sock->ConnCnt = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -933,8 +918,8 @@ SockConnFlush (
|
||||
**/
|
||||
VOID
|
||||
SockSetState (
|
||||
IN OUT SOCKET *Sock,
|
||||
IN UINT8 State
|
||||
IN OUT SOCKET *Sock,
|
||||
IN UINT8 State
|
||||
)
|
||||
{
|
||||
Sock->State = State;
|
||||
@@ -950,7 +935,7 @@ SockSetState (
|
||||
**/
|
||||
SOCKET *
|
||||
SockClone (
|
||||
IN SOCKET *Sock
|
||||
IN SOCKET *Sock
|
||||
)
|
||||
{
|
||||
SOCKET *ClonedSock;
|
||||
@@ -972,7 +957,7 @@ SockClone (
|
||||
InitData.ProtoData = Sock->ProtoReserved;
|
||||
InitData.DataSize = sizeof (Sock->ProtoReserved);
|
||||
|
||||
ClonedSock = SockCreate (&InitData);
|
||||
ClonedSock = SockCreate (&InitData);
|
||||
|
||||
if (NULL == ClonedSock) {
|
||||
DEBUG ((DEBUG_ERROR, "SockClone: no resource to create a cloned sock\n"));
|
||||
@@ -998,10 +983,9 @@ SockClone (
|
||||
**/
|
||||
VOID
|
||||
SockConnEstablished (
|
||||
IN OUT SOCKET *Sock
|
||||
IN OUT SOCKET *Sock
|
||||
)
|
||||
{
|
||||
|
||||
ASSERT (SO_CONNECTING == Sock->State);
|
||||
|
||||
SockSetState (Sock, SO_CONNECTED);
|
||||
@@ -1011,7 +995,6 @@ SockConnEstablished (
|
||||
} else {
|
||||
SockWakeListenToken (Sock);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1026,7 +1009,7 @@ SockConnEstablished (
|
||||
**/
|
||||
VOID
|
||||
SockConnClosed (
|
||||
IN OUT SOCKET *Sock
|
||||
IN OUT SOCKET *Sock
|
||||
)
|
||||
{
|
||||
if (Sock->CloseToken != NULL) {
|
||||
@@ -1040,7 +1023,6 @@ SockConnClosed (
|
||||
if (Sock->Parent != NULL) {
|
||||
SockDestroyChild (Sock);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1055,12 +1037,12 @@ SockConnClosed (
|
||||
**/
|
||||
VOID
|
||||
SockDataSent (
|
||||
IN OUT SOCKET *Sock,
|
||||
IN UINT32 Count
|
||||
IN OUT SOCKET *Sock,
|
||||
IN UINT32 Count
|
||||
)
|
||||
{
|
||||
SOCK_TOKEN *SockToken;
|
||||
SOCK_COMPLETION_TOKEN *SndToken;
|
||||
SOCK_TOKEN *SockToken;
|
||||
SOCK_COMPLETION_TOKEN *SndToken;
|
||||
|
||||
ASSERT (!IsListEmpty (&Sock->ProcessingSndTokenList));
|
||||
ASSERT (Count <= (Sock->SndBuffer.DataQueue)->BufSize);
|
||||
@@ -1080,15 +1062,13 @@ SockDataSent (
|
||||
SndToken = SockToken->Token;
|
||||
|
||||
if (SockToken->RemainDataLen <= Count) {
|
||||
|
||||
RemoveEntryList (&(SockToken->TokenList));
|
||||
SIGNAL_TOKEN (SndToken, EFI_SUCCESS);
|
||||
Count -= SockToken->RemainDataLen;
|
||||
FreePool (SockToken);
|
||||
} else {
|
||||
|
||||
SockToken->RemainDataLen -= Count;
|
||||
Count = 0;
|
||||
Count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1114,20 +1094,20 @@ SockDataSent (
|
||||
**/
|
||||
UINT32
|
||||
SockGetDataToSend (
|
||||
IN SOCKET *Sock,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Len,
|
||||
OUT UINT8 *Dest
|
||||
IN SOCKET *Sock,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Len,
|
||||
OUT UINT8 *Dest
|
||||
)
|
||||
{
|
||||
ASSERT ((Sock != NULL) && SockStream == Sock->Type);
|
||||
|
||||
return NetbufQueCopy (
|
||||
Sock->SndBuffer.DataQueue,
|
||||
Offset,
|
||||
Len,
|
||||
Dest
|
||||
);
|
||||
Sock->SndBuffer.DataQueue,
|
||||
Offset,
|
||||
Len,
|
||||
Dest
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1143,17 +1123,19 @@ SockGetDataToSend (
|
||||
**/
|
||||
VOID
|
||||
SockDataRcvd (
|
||||
IN OUT SOCKET *Sock,
|
||||
IN OUT NET_BUF *NetBuffer,
|
||||
IN UINT32 UrgLen
|
||||
IN OUT SOCKET *Sock,
|
||||
IN OUT NET_BUF *NetBuffer,
|
||||
IN UINT32 UrgLen
|
||||
)
|
||||
{
|
||||
ASSERT ((Sock != NULL) && (Sock->RcvBuffer.DataQueue != NULL) &&
|
||||
UrgLen <= NetBuffer->TotalSize);
|
||||
ASSERT (
|
||||
(Sock != NULL) && (Sock->RcvBuffer.DataQueue != NULL) &&
|
||||
UrgLen <= NetBuffer->TotalSize
|
||||
);
|
||||
|
||||
NET_GET_REF (NetBuffer);
|
||||
|
||||
((TCP_RSV_DATA *) (NetBuffer->ProtoData))->UrgLen = UrgLen;
|
||||
((TCP_RSV_DATA *)(NetBuffer->ProtoData))->UrgLen = UrgLen;
|
||||
|
||||
NetbufQueAppend (Sock->RcvBuffer.DataQueue, NetBuffer);
|
||||
|
||||
@@ -1176,8 +1158,8 @@ SockGetFreeSpace (
|
||||
IN UINT32 Which
|
||||
)
|
||||
{
|
||||
UINT32 BufferCC;
|
||||
SOCK_BUFFER *SockBuffer;
|
||||
UINT32 BufferCC;
|
||||
SOCK_BUFFER *SockBuffer;
|
||||
|
||||
ASSERT (Sock != NULL && ((SOCK_SND_BUF == Which) || (SOCK_RCV_BUF == Which)));
|
||||
|
||||
@@ -1190,7 +1172,6 @@ SockGetFreeSpace (
|
||||
BufferCC = (SockBuffer->DataQueue)->BufSize;
|
||||
|
||||
if (BufferCC >= SockBuffer->HighWater) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1209,7 +1190,7 @@ SockGetFreeSpace (
|
||||
**/
|
||||
VOID
|
||||
SockNoMoreData (
|
||||
IN OUT SOCKET *Sock
|
||||
IN OUT SOCKET *Sock
|
||||
)
|
||||
{
|
||||
EFI_STATUS Err;
|
||||
@@ -1217,7 +1198,6 @@ SockNoMoreData (
|
||||
SOCK_NO_MORE_DATA (Sock);
|
||||
|
||||
if (!IsListEmpty (&Sock->RcvTokenList)) {
|
||||
|
||||
ASSERT (0 == GET_RCV_DATASIZE (Sock));
|
||||
|
||||
Err = Sock->SockError;
|
||||
@@ -1227,6 +1207,5 @@ SockNoMoreData (
|
||||
SockFlushPendingToken (Sock, &Sock->RcvTokenList);
|
||||
|
||||
SOCK_ERROR (Sock, Err);
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@
|
||||
gBS->SignalEvent ((Token)->Event); \
|
||||
} while (0)
|
||||
|
||||
#define SOCK_HEADER_SPACE (60 + 60 + 72)
|
||||
#define SOCK_HEADER_SPACE (60 + 60 + 72)
|
||||
|
||||
/**
|
||||
Process the TCP send data, buffer the tcp txdata and append
|
||||
@@ -41,8 +41,8 @@
|
||||
**/
|
||||
EFI_STATUS
|
||||
SockProcessTcpSndData (
|
||||
IN SOCKET *Sock,
|
||||
IN VOID *TcpTxData
|
||||
IN SOCKET *Sock,
|
||||
IN VOID *TcpTxData
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -56,8 +56,8 @@ SockProcessTcpSndData (
|
||||
**/
|
||||
UINT32
|
||||
SockProcessRcvToken (
|
||||
IN OUT SOCKET *Sock,
|
||||
IN OUT SOCK_IO_TOKEN *RcvToken
|
||||
IN OUT SOCKET *Sock,
|
||||
IN OUT SOCK_IO_TOKEN *RcvToken
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -68,7 +68,7 @@ SockProcessRcvToken (
|
||||
**/
|
||||
VOID
|
||||
SockConnFlush (
|
||||
IN OUT SOCKET *Sock
|
||||
IN OUT SOCKET *Sock
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -98,7 +98,7 @@ SockCancelToken (
|
||||
**/
|
||||
SOCKET *
|
||||
SockCreate (
|
||||
IN SOCK_INIT_DATA *SockInitData
|
||||
IN SOCK_INIT_DATA *SockInitData
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -109,7 +109,7 @@ SockCreate (
|
||||
**/
|
||||
VOID
|
||||
SockDestroy (
|
||||
IN OUT SOCKET *Sock
|
||||
IN OUT SOCKET *Sock
|
||||
);
|
||||
|
||||
#endif
|
||||
|
@@ -21,12 +21,12 @@
|
||||
**/
|
||||
BOOLEAN
|
||||
SockTokenExistedInList (
|
||||
IN LIST_ENTRY *List,
|
||||
IN EFI_EVENT Event
|
||||
IN LIST_ENTRY *List,
|
||||
IN EFI_EVENT Event
|
||||
)
|
||||
{
|
||||
LIST_ENTRY *ListEntry;
|
||||
SOCK_TOKEN *SockToken;
|
||||
LIST_ENTRY *ListEntry;
|
||||
SOCK_TOKEN *SockToken;
|
||||
|
||||
NET_LIST_FOR_EACH (ListEntry, List) {
|
||||
SockToken = NET_LIST_USER_STRUCT (
|
||||
@@ -56,22 +56,20 @@ SockTokenExistedInList (
|
||||
**/
|
||||
BOOLEAN
|
||||
SockTokenExisted (
|
||||
IN SOCKET *Sock,
|
||||
IN EFI_EVENT Event
|
||||
IN SOCKET *Sock,
|
||||
IN EFI_EVENT Event
|
||||
)
|
||||
{
|
||||
|
||||
if (SockTokenExistedInList (&Sock->SndTokenList, Event) ||
|
||||
SockTokenExistedInList (&Sock->ProcessingSndTokenList, Event) ||
|
||||
SockTokenExistedInList (&Sock->RcvTokenList, Event) ||
|
||||
SockTokenExistedInList (&Sock->ListenTokenList, Event)
|
||||
) {
|
||||
|
||||
)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if ((Sock->ConnectionToken != NULL) && (Sock->ConnectionToken->Event == Event)) {
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -95,28 +93,27 @@ SockTokenExisted (
|
||||
**/
|
||||
SOCK_TOKEN *
|
||||
SockBufferToken (
|
||||
IN SOCKET *Sock,
|
||||
IN LIST_ENTRY *List,
|
||||
IN VOID *Token,
|
||||
IN UINT32 DataLen
|
||||
IN SOCKET *Sock,
|
||||
IN LIST_ENTRY *List,
|
||||
IN VOID *Token,
|
||||
IN UINT32 DataLen
|
||||
)
|
||||
{
|
||||
SOCK_TOKEN *SockToken;
|
||||
|
||||
SockToken = AllocateZeroPool (sizeof (SOCK_TOKEN));
|
||||
if (NULL == SockToken) {
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_ERROR,
|
||||
"SockBufferIOToken: No Memory to allocate SockToken\n")
|
||||
"SockBufferIOToken: No Memory to allocate SockToken\n")
|
||||
);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SockToken->Sock = Sock;
|
||||
SockToken->Token = (SOCK_COMPLETION_TOKEN *) Token;
|
||||
SockToken->RemainDataLen = DataLen;
|
||||
SockToken->Sock = Sock;
|
||||
SockToken->Token = (SOCK_COMPLETION_TOKEN *)Token;
|
||||
SockToken->RemainDataLen = DataLen;
|
||||
InsertTailList (List, &SockToken->TokenList);
|
||||
|
||||
return SockToken;
|
||||
@@ -133,15 +130,15 @@ SockBufferToken (
|
||||
**/
|
||||
EFI_STATUS
|
||||
SockDestroyChild (
|
||||
IN OUT SOCKET *Sock
|
||||
IN OUT SOCKET *Sock
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
TCP_PROTO_DATA *ProtoData;
|
||||
TCP_CB *Tcb;
|
||||
EFI_GUID *IpProtocolGuid;
|
||||
EFI_GUID *TcpProtocolGuid;
|
||||
VOID *SockProtocol;
|
||||
EFI_STATUS Status;
|
||||
TCP_PROTO_DATA *ProtoData;
|
||||
TCP_CB *Tcb;
|
||||
EFI_GUID *IpProtocolGuid;
|
||||
EFI_GUID *TcpProtocolGuid;
|
||||
VOID *SockProtocol;
|
||||
|
||||
ASSERT ((Sock != NULL) && (Sock->ProtoHandler != NULL));
|
||||
|
||||
@@ -152,13 +149,14 @@ SockDestroyChild (
|
||||
Sock->InDestroy = TRUE;
|
||||
|
||||
if (Sock->IpVersion == IP_VERSION_4) {
|
||||
IpProtocolGuid = &gEfiIp4ProtocolGuid;
|
||||
IpProtocolGuid = &gEfiIp4ProtocolGuid;
|
||||
TcpProtocolGuid = &gEfiTcp4ProtocolGuid;
|
||||
} else {
|
||||
IpProtocolGuid = &gEfiIp6ProtocolGuid;
|
||||
IpProtocolGuid = &gEfiIp6ProtocolGuid;
|
||||
TcpProtocolGuid = &gEfiTcp6ProtocolGuid;
|
||||
}
|
||||
ProtoData = (TCP_PROTO_DATA *) Sock->ProtoReserved;
|
||||
|
||||
ProtoData = (TCP_PROTO_DATA *)Sock->ProtoReserved;
|
||||
Tcb = ProtoData->TcpPcb;
|
||||
|
||||
ASSERT (Tcb != NULL);
|
||||
@@ -190,11 +188,10 @@ SockDestroyChild (
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_ERROR,
|
||||
"SockDestroyChild: Open protocol installed on socket failed with %r\n",
|
||||
Status)
|
||||
"SockDestroyChild: Open protocol installed on socket failed with %r\n",
|
||||
Status)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -202,20 +199,18 @@ SockDestroyChild (
|
||||
// Uninstall the protocol installed on this sock
|
||||
//
|
||||
gBS->UninstallMultipleProtocolInterfaces (
|
||||
Sock->SockHandle,
|
||||
TcpProtocolGuid,
|
||||
SockProtocol,
|
||||
NULL
|
||||
);
|
||||
Sock->SockHandle,
|
||||
TcpProtocolGuid,
|
||||
SockProtocol,
|
||||
NULL
|
||||
);
|
||||
|
||||
|
||||
Status = EfiAcquireLockOrFail (&(Sock->Lock));
|
||||
Status = EfiAcquireLockOrFail (&(Sock->Lock));
|
||||
if (EFI_ERROR (Status)) {
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_ERROR,
|
||||
"SockDestroyChild: Get the lock to access socket failed with %r\n",
|
||||
Status)
|
||||
"SockDestroyChild: Get the lock to access socket failed with %r\n",
|
||||
Status)
|
||||
);
|
||||
|
||||
return EFI_ACCESS_DENIED;
|
||||
@@ -227,16 +222,14 @@ SockDestroyChild (
|
||||
Status = Sock->ProtoHandler (Sock, SOCK_DETACH, NULL);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_ERROR,
|
||||
"SockDestroyChild: Protocol detach socket failed with %r\n",
|
||||
Status)
|
||||
"SockDestroyChild: Protocol detach socket failed with %r\n",
|
||||
Status)
|
||||
);
|
||||
|
||||
Sock->InDestroy = FALSE;
|
||||
} else if (SOCK_IS_CONFIGURED (Sock)) {
|
||||
|
||||
SockConnFlush (Sock);
|
||||
SockSetState (Sock, SO_CLOSED);
|
||||
|
||||
@@ -265,7 +258,7 @@ SockDestroyChild (
|
||||
**/
|
||||
SOCKET *
|
||||
SockCreateChild (
|
||||
IN SOCK_INIT_DATA *SockInitData
|
||||
IN SOCK_INIT_DATA *SockInitData
|
||||
)
|
||||
{
|
||||
SOCKET *Sock;
|
||||
@@ -278,10 +271,9 @@ SockCreateChild (
|
||||
//
|
||||
Sock = SockCreate (SockInitData);
|
||||
if (NULL == Sock) {
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_ERROR,
|
||||
"SockCreateChild: No resource to create a new socket\n")
|
||||
"SockCreateChild: No resource to create a new socket\n")
|
||||
);
|
||||
|
||||
return NULL;
|
||||
@@ -289,14 +281,14 @@ SockCreateChild (
|
||||
|
||||
Status = EfiAcquireLockOrFail (&(Sock->Lock));
|
||||
if (EFI_ERROR (Status)) {
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_ERROR,
|
||||
"SockCreateChild: Get the lock to access socket failed with %r\n",
|
||||
Status)
|
||||
"SockCreateChild: Get the lock to access socket failed with %r\n",
|
||||
Status)
|
||||
);
|
||||
goto ERROR;
|
||||
}
|
||||
|
||||
//
|
||||
// inform the protocol layer to attach the socket
|
||||
// with a new protocol control block
|
||||
@@ -304,11 +296,10 @@ SockCreateChild (
|
||||
Status = Sock->ProtoHandler (Sock, SOCK_ATTACH, NULL);
|
||||
EfiReleaseLock (&(Sock->Lock));
|
||||
if (EFI_ERROR (Status)) {
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_ERROR,
|
||||
"SockCreateChild: Protocol failed to attach a socket with %r\n",
|
||||
Status)
|
||||
"SockCreateChild: Protocol failed to attach a socket with %r\n",
|
||||
Status)
|
||||
);
|
||||
goto ERROR;
|
||||
}
|
||||
@@ -339,13 +330,13 @@ ERROR:
|
||||
// Uninstall the protocol installed on this sock
|
||||
//
|
||||
gBS->UninstallMultipleProtocolInterfaces (
|
||||
Sock->SockHandle,
|
||||
TcpProtocolGuid,
|
||||
SockProtocol,
|
||||
NULL
|
||||
);
|
||||
SockDestroy (Sock);
|
||||
return NULL;
|
||||
Sock->SockHandle,
|
||||
TcpProtocolGuid,
|
||||
SockProtocol,
|
||||
NULL
|
||||
);
|
||||
SockDestroy (Sock);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -361,19 +352,18 @@ ERROR:
|
||||
**/
|
||||
EFI_STATUS
|
||||
SockConfigure (
|
||||
IN SOCKET *Sock,
|
||||
IN VOID *ConfigData
|
||||
IN SOCKET *Sock,
|
||||
IN VOID *ConfigData
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = EfiAcquireLockOrFail (&(Sock->Lock));
|
||||
if (EFI_ERROR (Status)) {
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_ERROR,
|
||||
"SockConfigure: Get the access for socket failed with %r",
|
||||
Status)
|
||||
"SockConfigure: Get the access for socket failed with %r",
|
||||
Status)
|
||||
);
|
||||
|
||||
return EFI_ACCESS_DENIED;
|
||||
@@ -414,8 +404,8 @@ OnExit:
|
||||
**/
|
||||
EFI_STATUS
|
||||
SockConnect (
|
||||
IN SOCKET *Sock,
|
||||
IN VOID *Token
|
||||
IN SOCKET *Sock,
|
||||
IN VOID *Token
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
@@ -423,11 +413,10 @@ SockConnect (
|
||||
|
||||
Status = EfiAcquireLockOrFail (&(Sock->Lock));
|
||||
if (EFI_ERROR (Status)) {
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_ERROR,
|
||||
"SockConnect: Get the access for socket failed with %r",
|
||||
Status)
|
||||
"SockConnect: Get the access for socket failed with %r",
|
||||
Status)
|
||||
);
|
||||
|
||||
return EFI_ACCESS_DENIED;
|
||||
@@ -439,26 +428,23 @@ SockConnect (
|
||||
}
|
||||
|
||||
if (SOCK_IS_UNCONFIGURED (Sock)) {
|
||||
|
||||
Status = EFI_NOT_STARTED;
|
||||
goto OnExit;
|
||||
}
|
||||
|
||||
if (!SOCK_IS_CLOSED (Sock) || !SOCK_IS_CONFIGURED_ACTIVE (Sock)) {
|
||||
|
||||
Status = EFI_ACCESS_DENIED;
|
||||
goto OnExit;
|
||||
}
|
||||
|
||||
Event = ((SOCK_COMPLETION_TOKEN *) Token)->Event;
|
||||
Event = ((SOCK_COMPLETION_TOKEN *)Token)->Event;
|
||||
|
||||
if (SockTokenExisted (Sock, Event)) {
|
||||
|
||||
Status = EFI_ACCESS_DENIED;
|
||||
goto OnExit;
|
||||
}
|
||||
|
||||
Sock->ConnectionToken = (SOCK_COMPLETION_TOKEN *) Token;
|
||||
Sock->ConnectionToken = (SOCK_COMPLETION_TOKEN *)Token;
|
||||
SockSetState (Sock, SO_CONNECTING);
|
||||
Status = Sock->ProtoHandler (Sock, SOCK_CONNECT, NULL);
|
||||
|
||||
@@ -488,25 +474,24 @@ OnExit:
|
||||
**/
|
||||
EFI_STATUS
|
||||
SockAccept (
|
||||
IN SOCKET *Sock,
|
||||
IN VOID *Token
|
||||
IN SOCKET *Sock,
|
||||
IN VOID *Token
|
||||
)
|
||||
{
|
||||
EFI_TCP4_LISTEN_TOKEN *ListenToken;
|
||||
LIST_ENTRY *ListEntry;
|
||||
EFI_STATUS Status;
|
||||
SOCKET *Socket;
|
||||
EFI_EVENT Event;
|
||||
EFI_TCP4_LISTEN_TOKEN *ListenToken;
|
||||
LIST_ENTRY *ListEntry;
|
||||
EFI_STATUS Status;
|
||||
SOCKET *Socket;
|
||||
EFI_EVENT Event;
|
||||
|
||||
ASSERT (SockStream == Sock->Type);
|
||||
|
||||
Status = EfiAcquireLockOrFail (&(Sock->Lock));
|
||||
if (EFI_ERROR (Status)) {
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_ERROR,
|
||||
"SockAccept: Get the access for socket failed with %r",
|
||||
Status)
|
||||
"SockAccept: Get the access for socket failed with %r",
|
||||
Status)
|
||||
);
|
||||
|
||||
return EFI_ACCESS_DENIED;
|
||||
@@ -518,32 +503,28 @@ SockAccept (
|
||||
}
|
||||
|
||||
if (SOCK_IS_UNCONFIGURED (Sock)) {
|
||||
|
||||
Status = EFI_NOT_STARTED;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
if (!SOCK_IS_LISTENING (Sock)) {
|
||||
|
||||
Status = EFI_ACCESS_DENIED;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Event = ((SOCK_COMPLETION_TOKEN *) Token)->Event;
|
||||
Event = ((SOCK_COMPLETION_TOKEN *)Token)->Event;
|
||||
|
||||
if (SockTokenExisted (Sock, Event)) {
|
||||
|
||||
Status = EFI_ACCESS_DENIED;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
ListenToken = (EFI_TCP4_LISTEN_TOKEN *) Token;
|
||||
ListenToken = (EFI_TCP4_LISTEN_TOKEN *)Token;
|
||||
|
||||
//
|
||||
// Check if a connection has already in this Sock->ConnectionList
|
||||
//
|
||||
NET_LIST_FOR_EACH (ListEntry, &Sock->ConnectionList) {
|
||||
|
||||
Socket = NET_LIST_USER_STRUCT (ListEntry, SOCKET, ConnectionList);
|
||||
|
||||
if (SOCK_IS_CONNECTED (Socket)) {
|
||||
@@ -558,8 +539,8 @@ SockAccept (
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"SockAccept: Accept a socket, now conncount is %d",
|
||||
Socket->Parent->ConnCnt)
|
||||
"SockAccept: Accept a socket, now conncount is %d",
|
||||
Socket->Parent->ConnCnt)
|
||||
);
|
||||
Socket->Parent = NULL;
|
||||
|
||||
@@ -571,7 +552,6 @@ SockAccept (
|
||||
// Buffer this token for latter incoming connection request
|
||||
//
|
||||
if (NULL == SockBufferToken (Sock, &(Sock->ListenTokenList), Token, 0)) {
|
||||
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
@@ -601,8 +581,8 @@ Exit:
|
||||
**/
|
||||
EFI_STATUS
|
||||
SockSend (
|
||||
IN SOCKET *Sock,
|
||||
IN VOID *Token
|
||||
IN SOCKET *Sock,
|
||||
IN VOID *Token
|
||||
)
|
||||
{
|
||||
SOCK_IO_TOKEN *SndToken;
|
||||
@@ -617,11 +597,10 @@ SockSend (
|
||||
|
||||
Status = EfiAcquireLockOrFail (&(Sock->Lock));
|
||||
if (EFI_ERROR (Status)) {
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_ERROR,
|
||||
"SockSend: Get the access for socket failed with %r",
|
||||
Status)
|
||||
"SockSend: Get the access for socket failed with %r",
|
||||
Status)
|
||||
);
|
||||
|
||||
return EFI_ACCESS_DENIED;
|
||||
@@ -632,8 +611,8 @@ SockSend (
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
SndToken = (SOCK_IO_TOKEN *) Token;
|
||||
TxData = (EFI_TCP4_TRANSMIT_DATA *) SndToken->Packet.TxData;
|
||||
SndToken = (SOCK_IO_TOKEN *)Token;
|
||||
TxData = (EFI_TCP4_TRANSMIT_DATA *)SndToken->Packet.TxData;
|
||||
|
||||
if (SOCK_IS_UNCONFIGURED (Sock)) {
|
||||
Status = EFI_NOT_STARTED;
|
||||
@@ -641,7 +620,6 @@ SockSend (
|
||||
}
|
||||
|
||||
if (!(SOCK_IS_CONNECTING (Sock) || SOCK_IS_CONNECTED (Sock))) {
|
||||
|
||||
Status = EFI_ACCESS_DENIED;
|
||||
goto Exit;
|
||||
}
|
||||
@@ -664,7 +642,6 @@ SockSend (
|
||||
FreeSpace = SockGetFreeSpace (Sock, SOCK_SND_BUF);
|
||||
|
||||
if ((FreeSpace < Sock->SndBuffer.LowWater) || !SOCK_IS_CONNECTED (Sock)) {
|
||||
|
||||
SockToken = SockBufferToken (
|
||||
Sock,
|
||||
&Sock->SndTokenList,
|
||||
@@ -676,7 +653,6 @@ SockSend (
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
} else {
|
||||
|
||||
SockToken = SockBufferToken (
|
||||
Sock,
|
||||
&Sock->ProcessingSndTokenList,
|
||||
@@ -687,8 +663,8 @@ SockSend (
|
||||
if (NULL == SockToken) {
|
||||
DEBUG (
|
||||
(DEBUG_ERROR,
|
||||
"SockSend: Failed to buffer IO token into socket processing SndToken List\n",
|
||||
Status)
|
||||
"SockSend: Failed to buffer IO token into socket processing SndToken List\n",
|
||||
Status)
|
||||
);
|
||||
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
@@ -700,8 +676,8 @@ SockSend (
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG (
|
||||
(DEBUG_ERROR,
|
||||
"SockSend: Failed to process Snd Data\n",
|
||||
Status)
|
||||
"SockSend: Failed to process Snd Data\n",
|
||||
Status)
|
||||
);
|
||||
|
||||
RemoveEntryList (&(SockToken->TokenList));
|
||||
@@ -735,48 +711,44 @@ Exit:
|
||||
**/
|
||||
EFI_STATUS
|
||||
SockRcv (
|
||||
IN SOCKET *Sock,
|
||||
IN VOID *Token
|
||||
IN SOCKET *Sock,
|
||||
IN VOID *Token
|
||||
)
|
||||
{
|
||||
SOCK_IO_TOKEN *RcvToken;
|
||||
UINT32 RcvdBytes;
|
||||
EFI_STATUS Status;
|
||||
EFI_EVENT Event;
|
||||
SOCK_IO_TOKEN *RcvToken;
|
||||
UINT32 RcvdBytes;
|
||||
EFI_STATUS Status;
|
||||
EFI_EVENT Event;
|
||||
|
||||
ASSERT (SockStream == Sock->Type);
|
||||
|
||||
Status = EfiAcquireLockOrFail (&(Sock->Lock));
|
||||
if (EFI_ERROR (Status)) {
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_ERROR,
|
||||
"SockRcv: Get the access for socket failed with %r",
|
||||
Status)
|
||||
"SockRcv: Get the access for socket failed with %r",
|
||||
Status)
|
||||
);
|
||||
|
||||
return EFI_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
if (SOCK_IS_NO_MAPPING (Sock)) {
|
||||
|
||||
Status = EFI_NO_MAPPING;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
if (SOCK_IS_UNCONFIGURED (Sock)) {
|
||||
|
||||
Status = EFI_NOT_STARTED;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
if (!(SOCK_IS_CONNECTED (Sock) || SOCK_IS_CONNECTING (Sock))) {
|
||||
|
||||
Status = EFI_ACCESS_DENIED;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
RcvToken = (SOCK_IO_TOKEN *) Token;
|
||||
RcvToken = (SOCK_IO_TOKEN *)Token;
|
||||
|
||||
//
|
||||
// check if a token is already in the token buffer of this socket
|
||||
@@ -787,14 +759,13 @@ SockRcv (
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
RcvToken = (SOCK_IO_TOKEN *) Token;
|
||||
RcvToken = (SOCK_IO_TOKEN *)Token;
|
||||
RcvdBytes = GET_RCV_DATASIZE (Sock);
|
||||
|
||||
//
|
||||
// check whether an error has happened before
|
||||
//
|
||||
if (EFI_ABORTED != Sock->SockError) {
|
||||
|
||||
SIGNAL_TOKEN (&(RcvToken->Token), Sock->SockError);
|
||||
Sock->SockError = EFI_ABORTED;
|
||||
goto Exit;
|
||||
@@ -805,7 +776,6 @@ SockRcv (
|
||||
// data buffered in Sock->RcvBuffer
|
||||
//
|
||||
if (SOCK_IS_NO_MORE_DATA (Sock) && (0 == RcvdBytes)) {
|
||||
|
||||
Status = EFI_CONNECTION_FIN;
|
||||
goto Exit;
|
||||
}
|
||||
@@ -815,7 +785,6 @@ SockRcv (
|
||||
|
||||
Status = Sock->ProtoHandler (Sock, SOCK_CONSUMED, NULL);
|
||||
} else {
|
||||
|
||||
if (NULL == SockBufferToken (Sock, &Sock->RcvTokenList, RcvToken, 0)) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
@@ -837,7 +806,7 @@ Exit:
|
||||
**/
|
||||
EFI_STATUS
|
||||
SockFlush (
|
||||
IN OUT SOCKET *Sock
|
||||
IN OUT SOCKET *Sock
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
@@ -846,29 +815,26 @@ SockFlush (
|
||||
|
||||
Status = EfiAcquireLockOrFail (&(Sock->Lock));
|
||||
if (EFI_ERROR (Status)) {
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_ERROR,
|
||||
"SockFlush: Get the access for socket failed with %r",
|
||||
Status)
|
||||
"SockFlush: Get the access for socket failed with %r",
|
||||
Status)
|
||||
);
|
||||
|
||||
return EFI_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
if (!SOCK_IS_CONFIGURED (Sock)) {
|
||||
|
||||
Status = EFI_ACCESS_DENIED;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Status = Sock->ProtoHandler (Sock, SOCK_FLUSH, NULL);
|
||||
if (EFI_ERROR (Status)) {
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_ERROR,
|
||||
"SockFlush: Protocol failed handling SOCK_FLUSH with %r",
|
||||
Status)
|
||||
"SockFlush: Protocol failed handling SOCK_FLUSH with %r",
|
||||
Status)
|
||||
);
|
||||
|
||||
goto Exit;
|
||||
@@ -906,9 +872,9 @@ Exit:
|
||||
**/
|
||||
EFI_STATUS
|
||||
SockClose (
|
||||
IN OUT SOCKET *Sock,
|
||||
IN VOID *Token,
|
||||
IN BOOLEAN OnAbort
|
||||
IN OUT SOCKET *Sock,
|
||||
IN VOID *Token,
|
||||
IN BOOLEAN OnAbort
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
@@ -920,8 +886,8 @@ SockClose (
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG (
|
||||
(DEBUG_ERROR,
|
||||
"SockClose: Get the access for socket failed with %r",
|
||||
Status)
|
||||
"SockClose: Get the access for socket failed with %r",
|
||||
Status)
|
||||
);
|
||||
|
||||
return EFI_ACCESS_DENIED;
|
||||
@@ -942,7 +908,7 @@ SockClose (
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Event = ((SOCK_COMPLETION_TOKEN *) Token)->Event;
|
||||
Event = ((SOCK_COMPLETION_TOKEN *)Token)->Event;
|
||||
|
||||
if (SockTokenExisted (Sock, Event)) {
|
||||
Status = EFI_ACCESS_DENIED;
|
||||
@@ -981,9 +947,9 @@ SockCancel (
|
||||
IN VOID *Token
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
ASSERT (SockStream == Sock->Type);
|
||||
|
||||
@@ -991,8 +957,8 @@ SockCancel (
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG (
|
||||
(DEBUG_ERROR,
|
||||
"SockCancel: Get the access for socket failed with %r",
|
||||
Status)
|
||||
"SockCancel: Get the access for socket failed with %r",
|
||||
Status)
|
||||
);
|
||||
|
||||
return EFI_ACCESS_DENIED;
|
||||
@@ -1006,7 +972,7 @@ SockCancel (
|
||||
//
|
||||
// 1. Check ConnectionToken.
|
||||
//
|
||||
if (Token == NULL || (SOCK_COMPLETION_TOKEN *) Token == Sock->ConnectionToken) {
|
||||
if ((Token == NULL) || ((SOCK_COMPLETION_TOKEN *)Token == Sock->ConnectionToken)) {
|
||||
if (Sock->ConnectionToken != NULL) {
|
||||
SIGNAL_TOKEN (Sock->ConnectionToken, EFI_ABORTED);
|
||||
Sock->ConnectionToken = NULL;
|
||||
@@ -1022,7 +988,7 @@ SockCancel (
|
||||
// 2. Check ListenTokenList.
|
||||
//
|
||||
Status = SockCancelToken (Token, &Sock->ListenTokenList);
|
||||
if (Token != NULL && !EFI_ERROR (Status)) {
|
||||
if ((Token != NULL) && !EFI_ERROR (Status)) {
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
@@ -1030,7 +996,7 @@ SockCancel (
|
||||
// 3. Check RcvTokenList.
|
||||
//
|
||||
Status = SockCancelToken (Token, &Sock->RcvTokenList);
|
||||
if (Token != NULL && !EFI_ERROR (Status)) {
|
||||
if ((Token != NULL) && !EFI_ERROR (Status)) {
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
@@ -1038,7 +1004,7 @@ SockCancel (
|
||||
// 4. Check SndTokenList.
|
||||
//
|
||||
Status = SockCancelToken (Token, &Sock->SndTokenList);
|
||||
if (Token != NULL && !EFI_ERROR (Status)) {
|
||||
if ((Token != NULL) && !EFI_ERROR (Status)) {
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
@@ -1052,7 +1018,6 @@ Exit:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Get the mode data of the low layer protocol.
|
||||
|
||||
@@ -1066,8 +1031,8 @@ Exit:
|
||||
**/
|
||||
EFI_STATUS
|
||||
SockGetMode (
|
||||
IN SOCKET *Sock,
|
||||
IN OUT VOID *Mode
|
||||
IN SOCKET *Sock,
|
||||
IN OUT VOID *Mode
|
||||
)
|
||||
{
|
||||
return Sock->ProtoHandler (Sock, SOCK_MODE, Mode);
|
||||
@@ -1090,8 +1055,8 @@ SockGetMode (
|
||||
**/
|
||||
EFI_STATUS
|
||||
SockRoute (
|
||||
IN SOCKET *Sock,
|
||||
IN VOID *RouteInfo
|
||||
IN SOCKET *Sock,
|
||||
IN VOID *RouteInfo
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
@@ -1100,8 +1065,8 @@ SockRoute (
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG (
|
||||
(DEBUG_ERROR,
|
||||
"SockRoute: Get the access for socket failed with %r",
|
||||
Status)
|
||||
"SockRoute: Get the access for socket failed with %r",
|
||||
Status)
|
||||
);
|
||||
|
||||
return EFI_ACCESS_DENIED;
|
||||
|
@@ -24,17 +24,17 @@
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/DpcLib.h>
|
||||
|
||||
#define SOCK_SND_BUF 0
|
||||
#define SOCK_RCV_BUF 1
|
||||
#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 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_NO_MORE_DATA 0x0001
|
||||
|
||||
//
|
||||
//
|
||||
@@ -61,11 +61,11 @@
|
||||
///
|
||||
/// Socket state
|
||||
///
|
||||
#define SO_CLOSED 0
|
||||
#define SO_LISTENING 1
|
||||
#define SO_CONNECTING 2
|
||||
#define SO_CONNECTED 3
|
||||
#define SO_DISCONNECTING 4
|
||||
#define SO_CLOSED 0
|
||||
#define SO_LISTENING 1
|
||||
#define SO_CONNECTING 2
|
||||
#define SO_CONNECTED 3
|
||||
#define SO_DISCONNECTING 4
|
||||
|
||||
///
|
||||
/// Socket configure state
|
||||
@@ -100,7 +100,7 @@
|
||||
@param[in] Sock Pointer to the socket
|
||||
|
||||
**/
|
||||
#define SOCK_NO_MORE_DATA(Sock) ((Sock)->Flag |= SO_NO_MORE_DATA)
|
||||
#define SOCK_NO_MORE_DATA(Sock) ((Sock)->Flag |= SO_NO_MORE_DATA)
|
||||
|
||||
/**
|
||||
Check whether the socket is unconfigured.
|
||||
@@ -135,7 +135,7 @@
|
||||
@retval FALSE The socket is not configured to active mode.
|
||||
|
||||
**/
|
||||
#define SOCK_IS_CONFIGURED_ACTIVE(Sock) ((Sock)->ConfigureState == SO_CONFIGURED_ACTIVE)
|
||||
#define SOCK_IS_CONFIGURED_ACTIVE(Sock) ((Sock)->ConfigureState == SO_CONFIGURED_ACTIVE)
|
||||
|
||||
/**
|
||||
Check whether the socket is configured to passive mode.
|
||||
@@ -146,7 +146,7 @@
|
||||
@retval FALSE The socket is not configured to passive mode.
|
||||
|
||||
**/
|
||||
#define SOCK_IS_CONNECTED_PASSIVE(Sock) ((Sock)->ConfigureState == SO_CONFIGURED_PASSIVE)
|
||||
#define SOCK_IS_CONNECTED_PASSIVE(Sock) ((Sock)->ConfigureState == SO_CONFIGURED_PASSIVE)
|
||||
|
||||
/**
|
||||
Check whether the socket is mapped.
|
||||
@@ -168,7 +168,7 @@
|
||||
@retval FALSE The socket is not closed.
|
||||
|
||||
**/
|
||||
#define SOCK_IS_CLOSED(Sock) ((Sock)->State == SO_CLOSED)
|
||||
#define SOCK_IS_CLOSED(Sock) ((Sock)->State == SO_CLOSED)
|
||||
|
||||
/**
|
||||
Check whether the socket is listening.
|
||||
@@ -179,7 +179,7 @@
|
||||
@retval FALSE The socket is not listening.
|
||||
|
||||
**/
|
||||
#define SOCK_IS_LISTENING(Sock) ((Sock)->State == SO_LISTENING)
|
||||
#define SOCK_IS_LISTENING(Sock) ((Sock)->State == SO_LISTENING)
|
||||
|
||||
/**
|
||||
Check whether the socket is connecting.
|
||||
@@ -190,7 +190,7 @@
|
||||
@retval FALSE The socket is not connecting.
|
||||
|
||||
**/
|
||||
#define SOCK_IS_CONNECTING(Sock) ((Sock)->State == SO_CONNECTING)
|
||||
#define SOCK_IS_CONNECTING(Sock) ((Sock)->State == SO_CONNECTING)
|
||||
|
||||
/**
|
||||
Check whether the socket has connected.
|
||||
@@ -201,7 +201,7 @@
|
||||
@retval FALSE The socket has not connected.
|
||||
|
||||
**/
|
||||
#define SOCK_IS_CONNECTED(Sock) ((Sock)->State == SO_CONNECTED)
|
||||
#define SOCK_IS_CONNECTED(Sock) ((Sock)->State == SO_CONNECTED)
|
||||
|
||||
/**
|
||||
Check whether the socket is disconnecting.
|
||||
@@ -212,7 +212,7 @@
|
||||
@retval FALSE The socket is not disconnecting.
|
||||
|
||||
**/
|
||||
#define SOCK_IS_DISCONNECTING(Sock) ((Sock)->State == SO_DISCONNECTING)
|
||||
#define SOCK_IS_DISCONNECTING(Sock) ((Sock)->State == SO_DISCONNECTING)
|
||||
|
||||
/**
|
||||
Check whether the socket is no more data.
|
||||
@@ -223,7 +223,7 @@
|
||||
@retval FALSE The socket still has data.
|
||||
|
||||
**/
|
||||
#define SOCK_IS_NO_MORE_DATA(Sock) (0 != ((Sock)->Flag & SO_NO_MORE_DATA))
|
||||
#define SOCK_IS_NO_MORE_DATA(Sock) (0 != ((Sock)->Flag & SO_NO_MORE_DATA))
|
||||
|
||||
/**
|
||||
Set the size of the receive buffer.
|
||||
@@ -242,7 +242,7 @@
|
||||
@return The receive buffer size.
|
||||
|
||||
**/
|
||||
#define GET_RCV_BUFFSIZE(Sock) ((Sock)->RcvBuffer.HighWater)
|
||||
#define GET_RCV_BUFFSIZE(Sock) ((Sock)->RcvBuffer.HighWater)
|
||||
|
||||
/**
|
||||
Get the size of the receive data.
|
||||
@@ -252,7 +252,7 @@
|
||||
@return The received data size.
|
||||
|
||||
**/
|
||||
#define GET_RCV_DATASIZE(Sock) (((Sock)->RcvBuffer.DataQueue)->BufSize)
|
||||
#define GET_RCV_DATASIZE(Sock) (((Sock)->RcvBuffer.DataQueue)->BufSize)
|
||||
|
||||
/**
|
||||
Set the size of the send buffer.
|
||||
@@ -271,7 +271,7 @@
|
||||
@return The send buffer size.
|
||||
|
||||
**/
|
||||
#define GET_SND_BUFFSIZE(Sock) ((Sock)->SndBuffer.HighWater)
|
||||
#define GET_SND_BUFFSIZE(Sock) ((Sock)->SndBuffer.HighWater)
|
||||
|
||||
/**
|
||||
Get the size of the send data.
|
||||
@@ -281,7 +281,7 @@
|
||||
@return The send data size.
|
||||
|
||||
**/
|
||||
#define GET_SND_DATASIZE(Sock) (((Sock)->SndBuffer.DataQueue)->BufSize)
|
||||
#define GET_SND_DATASIZE(Sock) (((Sock)->SndBuffer.DataQueue)->BufSize)
|
||||
|
||||
/**
|
||||
Set the backlog value of the socket.
|
||||
@@ -290,7 +290,7 @@
|
||||
@param[in] Value The value to set.
|
||||
|
||||
**/
|
||||
#define SET_BACKLOG(Sock, Value) ((Sock)->BackLog = (Value))
|
||||
#define SET_BACKLOG(Sock, Value) ((Sock)->BackLog = (Value))
|
||||
|
||||
/**
|
||||
Get the backlog value of the socket.
|
||||
@@ -300,7 +300,7 @@
|
||||
@return The backlog value.
|
||||
|
||||
**/
|
||||
#define GET_BACKLOG(Sock) ((Sock)->BackLog)
|
||||
#define GET_BACKLOG(Sock) ((Sock)->BackLog)
|
||||
|
||||
/**
|
||||
Set the socket with error state.
|
||||
@@ -309,13 +309,13 @@
|
||||
@param[in] Error The error state.
|
||||
|
||||
**/
|
||||
#define SOCK_ERROR(Sock, Error) ((Sock)->SockError = (Error))
|
||||
#define SOCK_ERROR(Sock, Error) ((Sock)->SockError = (Error))
|
||||
|
||||
#define SOCK_SIGNATURE SIGNATURE_32 ('S', 'O', 'C', 'K')
|
||||
#define SOCK_SIGNATURE SIGNATURE_32 ('S', 'O', 'C', 'K')
|
||||
|
||||
#define SOCK_FROM_THIS(a) CR ((a), SOCKET, NetProtocol, SOCK_SIGNATURE)
|
||||
#define SOCK_FROM_THIS(a) CR ((a), SOCKET, NetProtocol, SOCK_SIGNATURE)
|
||||
|
||||
#define SOCK_FROM_TOKEN(Token) (((SOCK_TOKEN *) (Token))->Sock)
|
||||
#define SOCK_FROM_TOKEN(Token) (((SOCK_TOKEN *) (Token))->Sock)
|
||||
|
||||
#define PROTO_TOKEN_FORM_SOCK(SockToken, Type) ((Type *) (((SOCK_TOKEN *) (SockToken))->Token))
|
||||
|
||||
@@ -325,21 +325,21 @@ typedef struct _TCP_SOCKET SOCKET;
|
||||
/// Socket completion token
|
||||
///
|
||||
typedef struct _SOCK_COMPLETION_TOKEN {
|
||||
EFI_EVENT Event; ///< The event to be issued
|
||||
EFI_STATUS Status; ///< The status to be issued
|
||||
EFI_EVENT Event; ///< The event to be issued
|
||||
EFI_STATUS Status; ///< The status to be issued
|
||||
} SOCK_COMPLETION_TOKEN;
|
||||
|
||||
typedef union {
|
||||
VOID *RxData;
|
||||
VOID *TxData;
|
||||
VOID *RxData;
|
||||
VOID *TxData;
|
||||
} SOCK_IO_DATA;
|
||||
|
||||
///
|
||||
/// The application token with data packet
|
||||
///
|
||||
typedef struct _SOCK_IO_TOKEN {
|
||||
SOCK_COMPLETION_TOKEN Token;
|
||||
SOCK_IO_DATA Packet;
|
||||
SOCK_COMPLETION_TOKEN Token;
|
||||
SOCK_IO_DATA Packet;
|
||||
} SOCK_IO_TOKEN;
|
||||
|
||||
///
|
||||
@@ -354,9 +354,9 @@ typedef enum {
|
||||
/// The buffer structure of rcvd data and send data used by socket.
|
||||
///
|
||||
typedef struct _SOCK_BUFFER {
|
||||
UINT32 HighWater; ///< The buffersize upper limit of sock_buffer
|
||||
UINT32 LowWater; ///< The low water mark of sock_buffer
|
||||
NET_BUF_QUEUE *DataQueue; ///< The queue to buffer data
|
||||
UINT32 HighWater; ///< The buffersize upper limit of sock_buffer
|
||||
UINT32 LowWater; ///< The low water mark of sock_buffer
|
||||
NET_BUF_QUEUE *DataQueue; ///< The queue to buffer data
|
||||
} SOCK_BUFFER;
|
||||
|
||||
/**
|
||||
@@ -374,9 +374,9 @@ typedef struct _SOCK_BUFFER {
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(*SOCK_PROTO_HANDLER) (
|
||||
IN SOCKET *Socket,
|
||||
IN UINT8 Request,
|
||||
IN VOID *RequestData
|
||||
IN SOCKET *Socket,
|
||||
IN UINT8 Request,
|
||||
IN VOID *RequestData
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -414,41 +414,41 @@ VOID
|
||||
/// The initialize data for create a new socket.
|
||||
///
|
||||
typedef struct _SOCK_INIT_DATA {
|
||||
SOCK_TYPE Type;
|
||||
UINT8 State;
|
||||
SOCK_TYPE Type;
|
||||
UINT8 State;
|
||||
|
||||
SOCKET *Parent; ///< The parent of this socket
|
||||
UINT32 BackLog; ///< The connection limit for listening socket
|
||||
UINT32 SndBufferSize; ///< The high water mark of send buffer
|
||||
UINT32 RcvBufferSize; ///< The high water mark of receive buffer
|
||||
UINT8 IpVersion;
|
||||
VOID *Protocol; ///< The pointer to protocol function template
|
||||
SOCKET *Parent; ///< The parent of this socket
|
||||
UINT32 BackLog; ///< The connection limit for listening socket
|
||||
UINT32 SndBufferSize; ///< The high water mark of send buffer
|
||||
UINT32 RcvBufferSize; ///< The high water mark of receive buffer
|
||||
UINT8 IpVersion;
|
||||
VOID *Protocol; ///< The pointer to protocol function template
|
||||
///< wanted to install on socket
|
||||
|
||||
//
|
||||
// Callbacks after socket is created and before socket is to be destroyed.
|
||||
//
|
||||
SOCK_CREATE_CALLBACK CreateCallback; ///< Callback after created
|
||||
SOCK_DESTROY_CALLBACK DestroyCallback; ///< Callback before destroyed
|
||||
VOID *Context; ///< The context of the callback
|
||||
SOCK_CREATE_CALLBACK CreateCallback; ///< Callback after created
|
||||
SOCK_DESTROY_CALLBACK DestroyCallback; ///< Callback before destroyed
|
||||
VOID *Context; ///< The context of the callback
|
||||
|
||||
//
|
||||
// Opaque protocol data.
|
||||
//
|
||||
VOID *ProtoData;
|
||||
UINT32 DataSize;
|
||||
VOID *ProtoData;
|
||||
UINT32 DataSize;
|
||||
|
||||
SOCK_PROTO_HANDLER ProtoHandler; ///< The handler of protocol for socket request
|
||||
SOCK_PROTO_HANDLER ProtoHandler; ///< The handler of protocol for socket request
|
||||
|
||||
EFI_HANDLE DriverBinding; ///< The driver binding handle
|
||||
EFI_HANDLE DriverBinding; ///< The driver binding handle
|
||||
} SOCK_INIT_DATA;
|
||||
|
||||
///
|
||||
/// The union type of TCP4 and TCP6 protocol.
|
||||
///
|
||||
typedef union _NET_PROTOCOL {
|
||||
EFI_TCP4_PROTOCOL Tcp4Protocol; ///< Tcp4 protocol
|
||||
EFI_TCP6_PROTOCOL Tcp6Protocol; ///< Tcp6 protocol
|
||||
EFI_TCP4_PROTOCOL Tcp4Protocol; ///< Tcp4 protocol
|
||||
EFI_TCP6_PROTOCOL Tcp6Protocol; ///< Tcp6 protocol
|
||||
} NET_PROTOCOL;
|
||||
///
|
||||
/// The socket structure representing a network service access point.
|
||||
@@ -457,70 +457,70 @@ struct _TCP_SOCKET {
|
||||
//
|
||||
// Socket description information
|
||||
//
|
||||
UINT32 Signature; ///< Signature of the socket
|
||||
EFI_HANDLE SockHandle; ///< The virtual handle of the socket
|
||||
EFI_HANDLE DriverBinding; ///< Socket's driver binding protocol
|
||||
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
LIST_ENTRY Link;
|
||||
UINT8 ConfigureState;
|
||||
SOCK_TYPE Type;
|
||||
UINT8 State;
|
||||
UINT16 Flag;
|
||||
EFI_LOCK Lock; ///< The lock of socket
|
||||
SOCK_BUFFER SndBuffer; ///< Send buffer of application's data
|
||||
SOCK_BUFFER RcvBuffer; ///< Receive buffer of received data
|
||||
EFI_STATUS SockError; ///< The error returned by low layer protocol
|
||||
BOOLEAN InDestroy;
|
||||
UINT32 Signature; ///< Signature of the socket
|
||||
EFI_HANDLE SockHandle; ///< The virtual handle of the socket
|
||||
EFI_HANDLE DriverBinding; ///< Socket's driver binding protocol
|
||||
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
LIST_ENTRY Link;
|
||||
UINT8 ConfigureState;
|
||||
SOCK_TYPE Type;
|
||||
UINT8 State;
|
||||
UINT16 Flag;
|
||||
EFI_LOCK Lock; ///< The lock of socket
|
||||
SOCK_BUFFER SndBuffer; ///< Send buffer of application's data
|
||||
SOCK_BUFFER RcvBuffer; ///< Receive buffer of received data
|
||||
EFI_STATUS SockError; ///< The error returned by low layer protocol
|
||||
BOOLEAN InDestroy;
|
||||
|
||||
//
|
||||
// Fields used to manage the connection request
|
||||
//
|
||||
UINT32 BackLog; ///< the limit of connection to this socket
|
||||
UINT32 ConnCnt; ///< the current count of connections to it
|
||||
SOCKET *Parent; ///< listening parent that accept the connection
|
||||
LIST_ENTRY ConnectionList; ///< the connections maintained by this socket
|
||||
UINT32 BackLog; ///< the limit of connection to this socket
|
||||
UINT32 ConnCnt; ///< the current count of connections to it
|
||||
SOCKET *Parent; ///< listening parent that accept the connection
|
||||
LIST_ENTRY ConnectionList; ///< the connections maintained by this socket
|
||||
//
|
||||
// The queue to buffer application's asynchronous token
|
||||
//
|
||||
LIST_ENTRY ListenTokenList;
|
||||
LIST_ENTRY RcvTokenList;
|
||||
LIST_ENTRY SndTokenList;
|
||||
LIST_ENTRY ProcessingSndTokenList;
|
||||
LIST_ENTRY ListenTokenList;
|
||||
LIST_ENTRY RcvTokenList;
|
||||
LIST_ENTRY SndTokenList;
|
||||
LIST_ENTRY ProcessingSndTokenList;
|
||||
|
||||
SOCK_COMPLETION_TOKEN *ConnectionToken; ///< app's token to signal if connected
|
||||
SOCK_COMPLETION_TOKEN *CloseToken; ///< app's token to signal if closed
|
||||
SOCK_COMPLETION_TOKEN *ConnectionToken; ///< app's token to signal if connected
|
||||
SOCK_COMPLETION_TOKEN *CloseToken; ///< app's token to signal if closed
|
||||
//
|
||||
// Interface for low level protocol
|
||||
//
|
||||
SOCK_PROTO_HANDLER ProtoHandler; ///< The request handler of protocol
|
||||
UINT8 ProtoReserved[PROTO_RESERVED_LEN]; ///< Data fields reserved for protocol
|
||||
UINT8 IpVersion;
|
||||
NET_PROTOCOL NetProtocol; ///< TCP4 or TCP6 protocol socket used
|
||||
SOCK_PROTO_HANDLER ProtoHandler; ///< The request handler of protocol
|
||||
UINT8 ProtoReserved[PROTO_RESERVED_LEN]; ///< Data fields reserved for protocol
|
||||
UINT8 IpVersion;
|
||||
NET_PROTOCOL NetProtocol; ///< TCP4 or TCP6 protocol socket used
|
||||
//
|
||||
// Callbacks after socket is created and before socket is to be destroyed.
|
||||
//
|
||||
SOCK_CREATE_CALLBACK CreateCallback; ///< Callback after created
|
||||
SOCK_DESTROY_CALLBACK DestroyCallback; ///< Callback before destroyed
|
||||
VOID *Context; ///< The context of the callback
|
||||
SOCK_CREATE_CALLBACK CreateCallback; ///< Callback after created
|
||||
SOCK_DESTROY_CALLBACK DestroyCallback; ///< Callback before destroyed
|
||||
VOID *Context; ///< The context of the callback
|
||||
};
|
||||
|
||||
///
|
||||
/// The token structure buffered in socket layer.
|
||||
///
|
||||
typedef struct _SOCK_TOKEN {
|
||||
LIST_ENTRY TokenList; ///< The entry to add in the token list
|
||||
SOCK_COMPLETION_TOKEN *Token; ///< The application's token
|
||||
UINT32 RemainDataLen; ///< Unprocessed data length
|
||||
SOCKET *Sock; ///< The pointer to the socket this token
|
||||
///< belongs to
|
||||
LIST_ENTRY TokenList; ///< The entry to add in the token list
|
||||
SOCK_COMPLETION_TOKEN *Token; ///< The application's token
|
||||
UINT32 RemainDataLen; ///< Unprocessed data length
|
||||
SOCKET *Sock; ///< The pointer to the socket this token
|
||||
///< belongs to
|
||||
} SOCK_TOKEN;
|
||||
|
||||
///
|
||||
/// Reserved data to access the NET_BUF delivered by TCP driver.
|
||||
///
|
||||
typedef struct _TCP_RSV_DATA {
|
||||
UINT32 UrgLen;
|
||||
UINT32 UrgLen;
|
||||
} TCP_RSV_DATA;
|
||||
|
||||
//
|
||||
@@ -536,8 +536,8 @@ typedef struct _TCP_RSV_DATA {
|
||||
**/
|
||||
VOID
|
||||
SockSetState (
|
||||
IN OUT SOCKET *Sock,
|
||||
IN UINT8 State
|
||||
IN OUT SOCKET *Sock,
|
||||
IN UINT8 State
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -550,7 +550,7 @@ SockSetState (
|
||||
**/
|
||||
SOCKET *
|
||||
SockClone (
|
||||
IN SOCKET *Sock
|
||||
IN SOCKET *Sock
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -566,7 +566,7 @@ SockClone (
|
||||
**/
|
||||
VOID
|
||||
SockConnEstablished (
|
||||
IN OUT SOCKET *Sock
|
||||
IN OUT SOCKET *Sock
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -581,7 +581,7 @@ SockConnEstablished (
|
||||
**/
|
||||
VOID
|
||||
SockConnClosed (
|
||||
IN OUT SOCKET *Sock
|
||||
IN OUT SOCKET *Sock
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -596,8 +596,8 @@ SockConnClosed (
|
||||
**/
|
||||
VOID
|
||||
SockDataSent (
|
||||
IN OUT SOCKET *Sock,
|
||||
IN UINT32 Count
|
||||
IN OUT SOCKET *Sock,
|
||||
IN UINT32 Count
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -615,10 +615,10 @@ SockDataSent (
|
||||
**/
|
||||
UINT32
|
||||
SockGetDataToSend (
|
||||
IN SOCKET *Sock,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Len,
|
||||
OUT UINT8 *Dest
|
||||
IN SOCKET *Sock,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Len,
|
||||
OUT UINT8 *Dest
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -634,9 +634,9 @@ SockGetDataToSend (
|
||||
**/
|
||||
VOID
|
||||
SockDataRcvd (
|
||||
IN OUT SOCKET *Sock,
|
||||
IN OUT NET_BUF *NetBuffer,
|
||||
IN UINT32 UrgLen
|
||||
IN OUT SOCKET *Sock,
|
||||
IN OUT NET_BUF *NetBuffer,
|
||||
IN UINT32 UrgLen
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -667,7 +667,7 @@ SockGetFreeSpace (
|
||||
**/
|
||||
VOID
|
||||
SockNoMoreData (
|
||||
IN OUT SOCKET *Sock
|
||||
IN OUT SOCKET *Sock
|
||||
);
|
||||
|
||||
//
|
||||
@@ -686,7 +686,7 @@ SockNoMoreData (
|
||||
**/
|
||||
SOCKET *
|
||||
SockCreateChild (
|
||||
IN SOCK_INIT_DATA *SockInitData
|
||||
IN SOCK_INIT_DATA *SockInitData
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -700,7 +700,7 @@ SockCreateChild (
|
||||
**/
|
||||
EFI_STATUS
|
||||
SockDestroyChild (
|
||||
IN OUT SOCKET *Sock
|
||||
IN OUT SOCKET *Sock
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -716,8 +716,8 @@ SockDestroyChild (
|
||||
**/
|
||||
EFI_STATUS
|
||||
SockConfigure (
|
||||
IN SOCKET *Sock,
|
||||
IN VOID *ConfigData
|
||||
IN SOCKET *Sock,
|
||||
IN VOID *ConfigData
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -740,8 +740,8 @@ SockConfigure (
|
||||
**/
|
||||
EFI_STATUS
|
||||
SockConnect (
|
||||
IN SOCKET *Sock,
|
||||
IN VOID *Token
|
||||
IN SOCKET *Sock,
|
||||
IN VOID *Token
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -765,8 +765,8 @@ SockConnect (
|
||||
**/
|
||||
EFI_STATUS
|
||||
SockAccept (
|
||||
IN SOCKET *Sock,
|
||||
IN VOID *Token
|
||||
IN SOCKET *Sock,
|
||||
IN VOID *Token
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -789,8 +789,8 @@ SockAccept (
|
||||
**/
|
||||
EFI_STATUS
|
||||
SockSend (
|
||||
IN SOCKET *Sock,
|
||||
IN VOID *Token
|
||||
IN SOCKET *Sock,
|
||||
IN VOID *Token
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -814,8 +814,8 @@ SockSend (
|
||||
**/
|
||||
EFI_STATUS
|
||||
SockRcv (
|
||||
IN SOCKET *Sock,
|
||||
IN VOID *Token
|
||||
IN SOCKET *Sock,
|
||||
IN VOID *Token
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -829,7 +829,7 @@ SockRcv (
|
||||
**/
|
||||
EFI_STATUS
|
||||
SockFlush (
|
||||
IN OUT SOCKET *Sock
|
||||
IN OUT SOCKET *Sock
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -853,9 +853,9 @@ SockFlush (
|
||||
**/
|
||||
EFI_STATUS
|
||||
SockClose (
|
||||
IN OUT SOCKET *Sock,
|
||||
IN VOID *Token,
|
||||
IN BOOLEAN OnAbort
|
||||
IN OUT SOCKET *Sock,
|
||||
IN VOID *Token,
|
||||
IN BOOLEAN OnAbort
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -889,8 +889,8 @@ SockCancel (
|
||||
**/
|
||||
EFI_STATUS
|
||||
SockGetMode (
|
||||
IN SOCKET *Sock,
|
||||
IN OUT VOID *Mode
|
||||
IN SOCKET *Sock,
|
||||
IN OUT VOID *Mode
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -910,8 +910,8 @@ SockGetMode (
|
||||
**/
|
||||
EFI_STATUS
|
||||
SockRoute (
|
||||
IN SOCKET *Sock,
|
||||
IN VOID *RouteInfo
|
||||
IN SOCKET *Sock,
|
||||
IN VOID *RouteInfo
|
||||
);
|
||||
|
||||
#endif
|
||||
|
@@ -32,11 +32,11 @@ Tcp4Route (
|
||||
IN TCP4_ROUTE_INFO *RouteInfo
|
||||
)
|
||||
{
|
||||
IP_IO_IP_PROTOCOL Ip;
|
||||
IP_IO_IP_PROTOCOL Ip;
|
||||
|
||||
Ip = Tcb->IpInfo->Ip;
|
||||
|
||||
ASSERT (Ip.Ip4!= NULL);
|
||||
ASSERT (Ip.Ip4 != NULL);
|
||||
|
||||
return Ip.Ip4->Routes (
|
||||
Ip.Ip4,
|
||||
@@ -45,7 +45,6 @@ Tcp4Route (
|
||||
RouteInfo->SubnetMask,
|
||||
RouteInfo->GatewayAddress
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,15 +61,15 @@ Tcp4Route (
|
||||
**/
|
||||
EFI_STATUS
|
||||
Tcp4GetMode (
|
||||
IN TCP_CB *Tcb,
|
||||
IN OUT TCP4_MODE_DATA *Mode
|
||||
IN TCP_CB *Tcb,
|
||||
IN OUT TCP4_MODE_DATA *Mode
|
||||
)
|
||||
{
|
||||
SOCKET *Sock;
|
||||
EFI_TCP4_CONFIG_DATA *ConfigData;
|
||||
EFI_TCP4_ACCESS_POINT *AccessPoint;
|
||||
EFI_TCP4_OPTION *Option;
|
||||
EFI_IP4_PROTOCOL *Ip;
|
||||
SOCKET *Sock;
|
||||
EFI_TCP4_CONFIG_DATA *ConfigData;
|
||||
EFI_TCP4_ACCESS_POINT *AccessPoint;
|
||||
EFI_TCP4_OPTION *Option;
|
||||
EFI_IP4_PROTOCOL *Ip;
|
||||
|
||||
Sock = Tcb->Sk;
|
||||
|
||||
@@ -79,46 +78,45 @@ Tcp4GetMode (
|
||||
}
|
||||
|
||||
if (Mode->Tcp4State != NULL) {
|
||||
*(Mode->Tcp4State) = (EFI_TCP4_CONNECTION_STATE) Tcb->State;
|
||||
*(Mode->Tcp4State) = (EFI_TCP4_CONNECTION_STATE)Tcb->State;
|
||||
}
|
||||
|
||||
if (Mode->Tcp4ConfigData != NULL) {
|
||||
ConfigData = Mode->Tcp4ConfigData;
|
||||
AccessPoint = &(ConfigData->AccessPoint);
|
||||
Option = ConfigData->ControlOption;
|
||||
|
||||
ConfigData = Mode->Tcp4ConfigData;
|
||||
AccessPoint = &(ConfigData->AccessPoint);
|
||||
Option = ConfigData->ControlOption;
|
||||
ConfigData->TypeOfService = Tcb->Tos;
|
||||
ConfigData->TimeToLive = Tcb->Ttl;
|
||||
|
||||
ConfigData->TypeOfService = Tcb->Tos;
|
||||
ConfigData->TimeToLive = Tcb->Ttl;
|
||||
|
||||
AccessPoint->UseDefaultAddress = Tcb->UseDefaultAddr;
|
||||
AccessPoint->UseDefaultAddress = Tcb->UseDefaultAddr;
|
||||
|
||||
IP4_COPY_ADDRESS (&AccessPoint->StationAddress, &Tcb->LocalEnd.Ip);
|
||||
|
||||
IP4_COPY_ADDRESS (&AccessPoint->SubnetMask, &Tcb->SubnetMask);
|
||||
AccessPoint->StationPort = NTOHS (Tcb->LocalEnd.Port);
|
||||
AccessPoint->StationPort = NTOHS (Tcb->LocalEnd.Port);
|
||||
|
||||
IP4_COPY_ADDRESS (&AccessPoint->RemoteAddress, &Tcb->RemoteEnd.Ip);
|
||||
|
||||
AccessPoint->RemotePort = NTOHS (Tcb->RemoteEnd.Port);
|
||||
AccessPoint->ActiveFlag = (BOOLEAN) (Tcb->State != TCP_LISTEN);
|
||||
AccessPoint->RemotePort = NTOHS (Tcb->RemoteEnd.Port);
|
||||
AccessPoint->ActiveFlag = (BOOLEAN)(Tcb->State != TCP_LISTEN);
|
||||
|
||||
if (Option != NULL) {
|
||||
Option->ReceiveBufferSize = GET_RCV_BUFFSIZE (Tcb->Sk);
|
||||
Option->SendBufferSize = GET_SND_BUFFSIZE (Tcb->Sk);
|
||||
Option->MaxSynBackLog = GET_BACKLOG (Tcb->Sk);
|
||||
Option->ReceiveBufferSize = GET_RCV_BUFFSIZE (Tcb->Sk);
|
||||
Option->SendBufferSize = GET_SND_BUFFSIZE (Tcb->Sk);
|
||||
Option->MaxSynBackLog = GET_BACKLOG (Tcb->Sk);
|
||||
|
||||
Option->ConnectionTimeout = Tcb->ConnectTimeout / TCP_TICK_HZ;
|
||||
Option->DataRetries = Tcb->MaxRexmit;
|
||||
Option->FinTimeout = Tcb->FinWait2Timeout / TCP_TICK_HZ;
|
||||
Option->TimeWaitTimeout = Tcb->TimeWaitTimeout / TCP_TICK_HZ;
|
||||
Option->KeepAliveProbes = Tcb->MaxKeepAlive;
|
||||
Option->KeepAliveTime = Tcb->KeepAliveIdle / TCP_TICK_HZ;
|
||||
Option->KeepAliveInterval = Tcb->KeepAlivePeriod / TCP_TICK_HZ;
|
||||
Option->ConnectionTimeout = Tcb->ConnectTimeout / TCP_TICK_HZ;
|
||||
Option->DataRetries = Tcb->MaxRexmit;
|
||||
Option->FinTimeout = Tcb->FinWait2Timeout / TCP_TICK_HZ;
|
||||
Option->TimeWaitTimeout = Tcb->TimeWaitTimeout / TCP_TICK_HZ;
|
||||
Option->KeepAliveProbes = Tcb->MaxKeepAlive;
|
||||
Option->KeepAliveTime = Tcb->KeepAliveIdle / TCP_TICK_HZ;
|
||||
Option->KeepAliveInterval = Tcb->KeepAlivePeriod / TCP_TICK_HZ;
|
||||
|
||||
Option->EnableNagle = (BOOLEAN) (!TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_NO_NAGLE));
|
||||
Option->EnableTimeStamp = (BOOLEAN) (!TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_NO_TS));
|
||||
Option->EnableWindowScaling = (BOOLEAN) (!TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_NO_WS));
|
||||
Option->EnableNagle = (BOOLEAN)(!TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_NO_NAGLE));
|
||||
Option->EnableTimeStamp = (BOOLEAN)(!TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_NO_TS));
|
||||
Option->EnableWindowScaling = (BOOLEAN)(!TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_NO_WS));
|
||||
|
||||
Option->EnableSelectiveAck = FALSE;
|
||||
Option->EnablePathMtuDiscovery = FALSE;
|
||||
@@ -145,15 +143,15 @@ Tcp4GetMode (
|
||||
**/
|
||||
EFI_STATUS
|
||||
Tcp6GetMode (
|
||||
IN TCP_CB *Tcb,
|
||||
IN OUT TCP6_MODE_DATA *Mode
|
||||
IN TCP_CB *Tcb,
|
||||
IN OUT TCP6_MODE_DATA *Mode
|
||||
)
|
||||
{
|
||||
SOCKET *Sock;
|
||||
EFI_TCP6_CONFIG_DATA *ConfigData;
|
||||
EFI_TCP6_ACCESS_POINT *AccessPoint;
|
||||
EFI_TCP6_OPTION *Option;
|
||||
EFI_IP6_PROTOCOL *Ip;
|
||||
SOCKET *Sock;
|
||||
EFI_TCP6_CONFIG_DATA *ConfigData;
|
||||
EFI_TCP6_ACCESS_POINT *AccessPoint;
|
||||
EFI_TCP6_OPTION *Option;
|
||||
EFI_IP6_PROTOCOL *Ip;
|
||||
|
||||
Sock = Tcb->Sk;
|
||||
|
||||
@@ -162,41 +160,40 @@ Tcp6GetMode (
|
||||
}
|
||||
|
||||
if (Mode->Tcp6State != NULL) {
|
||||
*(Mode->Tcp6State) = (EFI_TCP6_CONNECTION_STATE) (Tcb->State);
|
||||
*(Mode->Tcp6State) = (EFI_TCP6_CONNECTION_STATE)(Tcb->State);
|
||||
}
|
||||
|
||||
if (Mode->Tcp6ConfigData != NULL) {
|
||||
ConfigData = Mode->Tcp6ConfigData;
|
||||
AccessPoint = &(ConfigData->AccessPoint);
|
||||
Option = ConfigData->ControlOption;
|
||||
|
||||
ConfigData = Mode->Tcp6ConfigData;
|
||||
AccessPoint = &(ConfigData->AccessPoint);
|
||||
Option = ConfigData->ControlOption;
|
||||
ConfigData->TrafficClass = Tcb->Tos;
|
||||
ConfigData->HopLimit = Tcb->Ttl;
|
||||
|
||||
ConfigData->TrafficClass = Tcb->Tos;
|
||||
ConfigData->HopLimit = Tcb->Ttl;
|
||||
|
||||
AccessPoint->StationPort = NTOHS (Tcb->LocalEnd.Port);
|
||||
AccessPoint->RemotePort = NTOHS (Tcb->RemoteEnd.Port);
|
||||
AccessPoint->ActiveFlag = (BOOLEAN) (Tcb->State != TCP_LISTEN);
|
||||
AccessPoint->StationPort = NTOHS (Tcb->LocalEnd.Port);
|
||||
AccessPoint->RemotePort = NTOHS (Tcb->RemoteEnd.Port);
|
||||
AccessPoint->ActiveFlag = (BOOLEAN)(Tcb->State != TCP_LISTEN);
|
||||
|
||||
IP6_COPY_ADDRESS (&AccessPoint->StationAddress, &Tcb->LocalEnd.Ip);
|
||||
IP6_COPY_ADDRESS (&AccessPoint->RemoteAddress, &Tcb->RemoteEnd.Ip);
|
||||
|
||||
if (Option != NULL) {
|
||||
Option->ReceiveBufferSize = GET_RCV_BUFFSIZE (Tcb->Sk);
|
||||
Option->SendBufferSize = GET_SND_BUFFSIZE (Tcb->Sk);
|
||||
Option->MaxSynBackLog = GET_BACKLOG (Tcb->Sk);
|
||||
Option->ReceiveBufferSize = GET_RCV_BUFFSIZE (Tcb->Sk);
|
||||
Option->SendBufferSize = GET_SND_BUFFSIZE (Tcb->Sk);
|
||||
Option->MaxSynBackLog = GET_BACKLOG (Tcb->Sk);
|
||||
|
||||
Option->ConnectionTimeout = Tcb->ConnectTimeout / TCP_TICK_HZ;
|
||||
Option->DataRetries = Tcb->MaxRexmit;
|
||||
Option->FinTimeout = Tcb->FinWait2Timeout / TCP_TICK_HZ;
|
||||
Option->TimeWaitTimeout = Tcb->TimeWaitTimeout / TCP_TICK_HZ;
|
||||
Option->KeepAliveProbes = Tcb->MaxKeepAlive;
|
||||
Option->KeepAliveTime = Tcb->KeepAliveIdle / TCP_TICK_HZ;
|
||||
Option->KeepAliveInterval = Tcb->KeepAlivePeriod / TCP_TICK_HZ;
|
||||
Option->ConnectionTimeout = Tcb->ConnectTimeout / TCP_TICK_HZ;
|
||||
Option->DataRetries = Tcb->MaxRexmit;
|
||||
Option->FinTimeout = Tcb->FinWait2Timeout / TCP_TICK_HZ;
|
||||
Option->TimeWaitTimeout = Tcb->TimeWaitTimeout / TCP_TICK_HZ;
|
||||
Option->KeepAliveProbes = Tcb->MaxKeepAlive;
|
||||
Option->KeepAliveTime = Tcb->KeepAliveIdle / TCP_TICK_HZ;
|
||||
Option->KeepAliveInterval = Tcb->KeepAlivePeriod / TCP_TICK_HZ;
|
||||
|
||||
Option->EnableNagle = (BOOLEAN) (!TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_NO_NAGLE));
|
||||
Option->EnableTimeStamp = (BOOLEAN) (!TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_NO_TS));
|
||||
Option->EnableWindowScaling = (BOOLEAN) (!TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_NO_WS));
|
||||
Option->EnableNagle = (BOOLEAN)(!TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_NO_NAGLE));
|
||||
Option->EnableTimeStamp = (BOOLEAN)(!TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_NO_TS));
|
||||
Option->EnableWindowScaling = (BOOLEAN)(!TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_NO_WS));
|
||||
|
||||
Option->EnableSelectiveAck = FALSE;
|
||||
Option->EnablePathMtuDiscovery = FALSE;
|
||||
@@ -248,7 +245,6 @@ TcpBind (
|
||||
// Check if a same endpoing is bound.
|
||||
//
|
||||
if (TcpFindTcbByPeer (&Local, *Port, IpVersion)) {
|
||||
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
} else {
|
||||
@@ -270,14 +266,14 @@ TcpBind (
|
||||
if (Cycle) {
|
||||
DEBUG (
|
||||
(DEBUG_ERROR,
|
||||
"TcpBind: no port can be allocated for this pcb\n")
|
||||
"TcpBind: no port can be allocated for this pcb\n")
|
||||
);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
*RandomPort = TCP_PORT_KNOWN + 1;
|
||||
|
||||
Cycle = TRUE;
|
||||
Cycle = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,14 +291,14 @@ TcpBind (
|
||||
**/
|
||||
VOID
|
||||
TcpFlushPcb (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
)
|
||||
{
|
||||
SOCKET *Sock;
|
||||
SOCKET *Sock;
|
||||
|
||||
IpIoConfigIp (Tcb->IpInfo, NULL);
|
||||
|
||||
Sock = Tcb->Sk;
|
||||
Sock = Tcb->Sk;
|
||||
|
||||
if (SOCK_IS_CONFIGURED (Sock)) {
|
||||
RemoveEntryList (&Tcb->List);
|
||||
@@ -324,7 +320,7 @@ TcpFlushPcb (
|
||||
|
||||
NetbufFreeList (&Tcb->SndQue);
|
||||
NetbufFreeList (&Tcb->RcvQue);
|
||||
Tcb->State = TCP_CLOSED;
|
||||
Tcb->State = TCP_CLOSED;
|
||||
Tcb->RemoteIpZero = FALSE;
|
||||
}
|
||||
|
||||
@@ -358,13 +354,12 @@ TcpAttachPcb (
|
||||
Tcb = AllocateZeroPool (sizeof (TCP_CB));
|
||||
|
||||
if (Tcb == NULL) {
|
||||
|
||||
DEBUG ((DEBUG_ERROR, "TcpConfigurePcb: failed to allocate a TCB\n"));
|
||||
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
ProtoData = (TCP_PROTO_DATA *) Sk->ProtoReserved;
|
||||
ProtoData = (TCP_PROTO_DATA *)Sk->ProtoReserved;
|
||||
IpIo = ProtoData->TcpService->IpIo;
|
||||
|
||||
//
|
||||
@@ -372,7 +367,6 @@ TcpAttachPcb (
|
||||
//
|
||||
Tcb->IpInfo = IpIoAddIp (IpIo);
|
||||
if (Tcb->IpInfo == NULL) {
|
||||
|
||||
FreePool (Tcb);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
@@ -413,13 +407,13 @@ TcpAttachPcb (
|
||||
**/
|
||||
VOID
|
||||
TcpDetachPcb (
|
||||
IN OUT SOCKET *Sk
|
||||
IN OUT SOCKET *Sk
|
||||
)
|
||||
{
|
||||
TCP_PROTO_DATA *ProtoData;
|
||||
TCP_CB *Tcb;
|
||||
TCP_PROTO_DATA *ProtoData;
|
||||
TCP_CB *Tcb;
|
||||
|
||||
ProtoData = (TCP_PROTO_DATA *) Sk->ProtoReserved;
|
||||
ProtoData = (TCP_PROTO_DATA *)Sk->ProtoReserved;
|
||||
Tcb = ProtoData->TcpPcb;
|
||||
|
||||
ASSERT (Tcb != NULL);
|
||||
@@ -451,16 +445,16 @@ TcpConfigurePcb (
|
||||
IN TCP_CONFIG_DATA *CfgData
|
||||
)
|
||||
{
|
||||
IP_IO_IP_CONFIG_DATA IpCfgData;
|
||||
EFI_STATUS Status;
|
||||
EFI_TCP4_OPTION *Option;
|
||||
TCP_PROTO_DATA *TcpProto;
|
||||
TCP_CB *Tcb;
|
||||
TCP_ACCESS_POINT *TcpAp;
|
||||
IP_IO_IP_CONFIG_DATA IpCfgData;
|
||||
EFI_STATUS Status;
|
||||
EFI_TCP4_OPTION *Option;
|
||||
TCP_PROTO_DATA *TcpProto;
|
||||
TCP_CB *Tcb;
|
||||
TCP_ACCESS_POINT *TcpAp;
|
||||
|
||||
ASSERT ((CfgData != NULL) && (Sk != NULL) && (Sk->SockHandle != NULL));
|
||||
|
||||
TcpProto = (TCP_PROTO_DATA *) Sk->ProtoReserved;
|
||||
TcpProto = (TCP_PROTO_DATA *)Sk->ProtoReserved;
|
||||
Tcb = TcpProto->TcpPcb;
|
||||
|
||||
ASSERT (Tcb != NULL);
|
||||
@@ -470,28 +464,27 @@ TcpConfigurePcb (
|
||||
// Add Ip for send pkt to the peer
|
||||
//
|
||||
CopyMem (&IpCfgData.Ip4CfgData, &mIp4IoDefaultIpConfigData, sizeof (EFI_IP4_CONFIG_DATA));
|
||||
IpCfgData.Ip4CfgData.DefaultProtocol = EFI_IP_PROTO_TCP;
|
||||
IpCfgData.Ip4CfgData.TypeOfService = CfgData->Tcp4CfgData.TypeOfService;
|
||||
IpCfgData.Ip4CfgData.TimeToLive = CfgData->Tcp4CfgData.TimeToLive;
|
||||
IpCfgData.Ip4CfgData.UseDefaultAddress = CfgData->Tcp4CfgData.AccessPoint.UseDefaultAddress;
|
||||
IpCfgData.Ip4CfgData.DefaultProtocol = EFI_IP_PROTO_TCP;
|
||||
IpCfgData.Ip4CfgData.TypeOfService = CfgData->Tcp4CfgData.TypeOfService;
|
||||
IpCfgData.Ip4CfgData.TimeToLive = CfgData->Tcp4CfgData.TimeToLive;
|
||||
IpCfgData.Ip4CfgData.UseDefaultAddress = CfgData->Tcp4CfgData.AccessPoint.UseDefaultAddress;
|
||||
IP4_COPY_ADDRESS (
|
||||
&IpCfgData.Ip4CfgData.SubnetMask,
|
||||
&CfgData->Tcp4CfgData.AccessPoint.SubnetMask
|
||||
);
|
||||
IpCfgData.Ip4CfgData.ReceiveTimeout = (UINT32) (-1);
|
||||
IpCfgData.Ip4CfgData.ReceiveTimeout = (UINT32)(-1);
|
||||
IP4_COPY_ADDRESS (
|
||||
&IpCfgData.Ip4CfgData.StationAddress,
|
||||
&CfgData->Tcp4CfgData.AccessPoint.StationAddress
|
||||
);
|
||||
|
||||
} else {
|
||||
ASSERT (Sk->IpVersion == IP_VERSION_6);
|
||||
|
||||
CopyMem (&IpCfgData.Ip6CfgData, &mIp6IoDefaultIpConfigData, sizeof (EFI_IP6_CONFIG_DATA));
|
||||
IpCfgData.Ip6CfgData.DefaultProtocol = EFI_IP_PROTO_TCP;
|
||||
IpCfgData.Ip6CfgData.TrafficClass = CfgData->Tcp6CfgData.TrafficClass;
|
||||
IpCfgData.Ip6CfgData.HopLimit = CfgData->Tcp6CfgData.HopLimit;
|
||||
IpCfgData.Ip6CfgData.ReceiveTimeout = (UINT32) (-1);
|
||||
IpCfgData.Ip6CfgData.DefaultProtocol = EFI_IP_PROTO_TCP;
|
||||
IpCfgData.Ip6CfgData.TrafficClass = CfgData->Tcp6CfgData.TrafficClass;
|
||||
IpCfgData.Ip6CfgData.HopLimit = CfgData->Tcp6CfgData.HopLimit;
|
||||
IpCfgData.Ip6CfgData.ReceiveTimeout = (UINT32)(-1);
|
||||
IP6_COPY_ADDRESS (
|
||||
&IpCfgData.Ip6CfgData.StationAddress,
|
||||
&CfgData->Tcp6CfgData.AccessPoint.StationAddress
|
||||
@@ -523,14 +516,14 @@ TcpConfigurePcb (
|
||||
&IpCfgData.Ip4CfgData.SubnetMask
|
||||
);
|
||||
|
||||
TcpAp = (TCP_ACCESS_POINT *) &CfgData->Tcp4CfgData.AccessPoint;
|
||||
TcpAp = (TCP_ACCESS_POINT *)&CfgData->Tcp4CfgData.AccessPoint;
|
||||
} else {
|
||||
IP6_COPY_ADDRESS (
|
||||
&CfgData->Tcp6CfgData.AccessPoint.StationAddress,
|
||||
&IpCfgData.Ip6CfgData.StationAddress
|
||||
);
|
||||
|
||||
TcpAp = (TCP_ACCESS_POINT *) &CfgData->Tcp6CfgData.AccessPoint;
|
||||
TcpAp = (TCP_ACCESS_POINT *)&CfgData->Tcp6CfgData.AccessPoint;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -541,8 +534,8 @@ TcpConfigurePcb (
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG (
|
||||
(DEBUG_ERROR,
|
||||
"TcpConfigurePcb: Bind endpoint failed with %r\n",
|
||||
Status)
|
||||
"TcpConfigurePcb: Bind endpoint failed with %r\n",
|
||||
Status)
|
||||
);
|
||||
|
||||
goto OnExit;
|
||||
@@ -551,55 +544,57 @@ TcpConfigurePcb (
|
||||
//
|
||||
// Initialize the operating information in this Tcb
|
||||
//
|
||||
ASSERT (Tcb->State == TCP_CLOSED &&
|
||||
ASSERT (
|
||||
Tcb->State == TCP_CLOSED &&
|
||||
IsListEmpty (&Tcb->SndQue) &&
|
||||
IsListEmpty (&Tcb->RcvQue));
|
||||
IsListEmpty (&Tcb->RcvQue)
|
||||
);
|
||||
|
||||
TCP_SET_FLG (Tcb->CtrlFlag, TCP_CTRL_NO_KEEPALIVE);
|
||||
Tcb->State = TCP_CLOSED;
|
||||
Tcb->State = TCP_CLOSED;
|
||||
|
||||
Tcb->SndMss = 536;
|
||||
Tcb->RcvMss = TcpGetRcvMss (Sk);
|
||||
Tcb->SndMss = 536;
|
||||
Tcb->RcvMss = TcpGetRcvMss (Sk);
|
||||
|
||||
Tcb->SRtt = 0;
|
||||
Tcb->Rto = 3 * TCP_TICK_HZ;
|
||||
Tcb->SRtt = 0;
|
||||
Tcb->Rto = 3 * TCP_TICK_HZ;
|
||||
|
||||
Tcb->CWnd = Tcb->SndMss;
|
||||
Tcb->Ssthresh = 0xffffffff;
|
||||
Tcb->CWnd = Tcb->SndMss;
|
||||
Tcb->Ssthresh = 0xffffffff;
|
||||
|
||||
Tcb->CongestState = TCP_CONGEST_OPEN;
|
||||
Tcb->CongestState = TCP_CONGEST_OPEN;
|
||||
|
||||
Tcb->KeepAliveIdle = TCP_KEEPALIVE_IDLE_MIN;
|
||||
Tcb->KeepAlivePeriod = TCP_KEEPALIVE_PERIOD;
|
||||
Tcb->MaxKeepAlive = TCP_MAX_KEEPALIVE;
|
||||
Tcb->MaxRexmit = TCP_MAX_LOSS;
|
||||
Tcb->FinWait2Timeout = TCP_FIN_WAIT2_TIME;
|
||||
Tcb->TimeWaitTimeout = TCP_TIME_WAIT_TIME;
|
||||
Tcb->ConnectTimeout = TCP_CONNECT_TIME;
|
||||
Tcb->KeepAliveIdle = TCP_KEEPALIVE_IDLE_MIN;
|
||||
Tcb->KeepAlivePeriod = TCP_KEEPALIVE_PERIOD;
|
||||
Tcb->MaxKeepAlive = TCP_MAX_KEEPALIVE;
|
||||
Tcb->MaxRexmit = TCP_MAX_LOSS;
|
||||
Tcb->FinWait2Timeout = TCP_FIN_WAIT2_TIME;
|
||||
Tcb->TimeWaitTimeout = TCP_TIME_WAIT_TIME;
|
||||
Tcb->ConnectTimeout = TCP_CONNECT_TIME;
|
||||
|
||||
if (Sk->IpVersion == IP_VERSION_4) {
|
||||
//
|
||||
// initialize Tcb in the light of CfgData
|
||||
//
|
||||
Tcb->Ttl = CfgData->Tcp4CfgData.TimeToLive;
|
||||
Tcb->Tos = CfgData->Tcp4CfgData.TypeOfService;
|
||||
Tcb->Ttl = CfgData->Tcp4CfgData.TimeToLive;
|
||||
Tcb->Tos = CfgData->Tcp4CfgData.TypeOfService;
|
||||
|
||||
Tcb->UseDefaultAddr = CfgData->Tcp4CfgData.AccessPoint.UseDefaultAddress;
|
||||
|
||||
CopyMem (&Tcb->LocalEnd.Ip, &CfgData->Tcp4CfgData.AccessPoint.StationAddress, sizeof (IP4_ADDR));
|
||||
Tcb->LocalEnd.Port = HTONS (CfgData->Tcp4CfgData.AccessPoint.StationPort);
|
||||
Tcb->LocalEnd.Port = HTONS (CfgData->Tcp4CfgData.AccessPoint.StationPort);
|
||||
IP4_COPY_ADDRESS (&Tcb->SubnetMask, &CfgData->Tcp4CfgData.AccessPoint.SubnetMask);
|
||||
|
||||
CopyMem (&Tcb->RemoteEnd.Ip, &CfgData->Tcp4CfgData.AccessPoint.RemoteAddress, sizeof (IP4_ADDR));
|
||||
Tcb->RemoteEnd.Port = HTONS (CfgData->Tcp4CfgData.AccessPoint.RemotePort);
|
||||
|
||||
Option = CfgData->Tcp4CfgData.ControlOption;
|
||||
Option = CfgData->Tcp4CfgData.ControlOption;
|
||||
} else {
|
||||
Tcb->Ttl = CfgData->Tcp6CfgData.HopLimit;
|
||||
Tcb->Tos = CfgData->Tcp6CfgData.TrafficClass;
|
||||
Tcb->Ttl = CfgData->Tcp6CfgData.HopLimit;
|
||||
Tcb->Tos = CfgData->Tcp6CfgData.TrafficClass;
|
||||
|
||||
IP6_COPY_ADDRESS (&Tcb->LocalEnd.Ip, &CfgData->Tcp6CfgData.AccessPoint.StationAddress);
|
||||
Tcb->LocalEnd.Port = HTONS (CfgData->Tcp6CfgData.AccessPoint.StationPort);
|
||||
Tcb->LocalEnd.Port = HTONS (CfgData->Tcp6CfgData.AccessPoint.StationPort);
|
||||
|
||||
IP6_COPY_ADDRESS (&Tcb->RemoteEnd.Ip, &CfgData->Tcp6CfgData.AccessPoint.RemoteAddress);
|
||||
Tcb->RemoteEnd.Port = HTONS (CfgData->Tcp6CfgData.AccessPoint.RemotePort);
|
||||
@@ -607,61 +602,61 @@ TcpConfigurePcb (
|
||||
//
|
||||
// Type EFI_TCP4_OPTION and EFI_TCP6_OPTION are the same.
|
||||
//
|
||||
Option = (EFI_TCP4_OPTION *) CfgData->Tcp6CfgData.ControlOption;
|
||||
Option = (EFI_TCP4_OPTION *)CfgData->Tcp6CfgData.ControlOption;
|
||||
}
|
||||
|
||||
if (Option != NULL) {
|
||||
SET_RCV_BUFFSIZE (
|
||||
Sk,
|
||||
(UINT32) (TCP_COMP_VAL (
|
||||
TCP_RCV_BUF_SIZE_MIN,
|
||||
TCP_RCV_BUF_SIZE,
|
||||
TCP_RCV_BUF_SIZE,
|
||||
Option->ReceiveBufferSize
|
||||
)
|
||||
(UINT32)(TCP_COMP_VAL (
|
||||
TCP_RCV_BUF_SIZE_MIN,
|
||||
TCP_RCV_BUF_SIZE,
|
||||
TCP_RCV_BUF_SIZE,
|
||||
Option->ReceiveBufferSize
|
||||
)
|
||||
)
|
||||
);
|
||||
SET_SND_BUFFSIZE (
|
||||
Sk,
|
||||
(UINT32) (TCP_COMP_VAL (
|
||||
TCP_SND_BUF_SIZE_MIN,
|
||||
TCP_SND_BUF_SIZE,
|
||||
TCP_SND_BUF_SIZE,
|
||||
Option->SendBufferSize
|
||||
)
|
||||
(UINT32)(TCP_COMP_VAL (
|
||||
TCP_SND_BUF_SIZE_MIN,
|
||||
TCP_SND_BUF_SIZE,
|
||||
TCP_SND_BUF_SIZE,
|
||||
Option->SendBufferSize
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
SET_BACKLOG (
|
||||
Sk,
|
||||
(UINT32) (TCP_COMP_VAL (
|
||||
TCP_BACKLOG_MIN,
|
||||
TCP_BACKLOG,
|
||||
TCP_BACKLOG,
|
||||
Option->MaxSynBackLog
|
||||
)
|
||||
(UINT32)(TCP_COMP_VAL (
|
||||
TCP_BACKLOG_MIN,
|
||||
TCP_BACKLOG,
|
||||
TCP_BACKLOG,
|
||||
Option->MaxSynBackLog
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
Tcb->MaxRexmit = (UINT16) TCP_COMP_VAL (
|
||||
TCP_MAX_LOSS_MIN,
|
||||
TCP_MAX_LOSS,
|
||||
TCP_MAX_LOSS,
|
||||
Option->DataRetries
|
||||
);
|
||||
Tcb->MaxRexmit = (UINT16)TCP_COMP_VAL (
|
||||
TCP_MAX_LOSS_MIN,
|
||||
TCP_MAX_LOSS,
|
||||
TCP_MAX_LOSS,
|
||||
Option->DataRetries
|
||||
);
|
||||
Tcb->FinWait2Timeout = TCP_COMP_VAL (
|
||||
TCP_FIN_WAIT2_TIME,
|
||||
TCP_FIN_WAIT2_TIME_MAX,
|
||||
TCP_FIN_WAIT2_TIME,
|
||||
(UINT32) (Option->FinTimeout * TCP_TICK_HZ)
|
||||
);
|
||||
TCP_FIN_WAIT2_TIME,
|
||||
TCP_FIN_WAIT2_TIME_MAX,
|
||||
TCP_FIN_WAIT2_TIME,
|
||||
(UINT32)(Option->FinTimeout * TCP_TICK_HZ)
|
||||
);
|
||||
|
||||
if (Option->TimeWaitTimeout != 0) {
|
||||
Tcb->TimeWaitTimeout = TCP_COMP_VAL (
|
||||
TCP_TIME_WAIT_TIME,
|
||||
TCP_TIME_WAIT_TIME_MAX,
|
||||
TCP_TIME_WAIT_TIME,
|
||||
(UINT32) (Option->TimeWaitTimeout * TCP_TICK_HZ)
|
||||
(UINT32)(Option->TimeWaitTimeout * TCP_TICK_HZ)
|
||||
);
|
||||
} else {
|
||||
Tcb->TimeWaitTimeout = 0;
|
||||
@@ -670,23 +665,23 @@ TcpConfigurePcb (
|
||||
if (Option->KeepAliveProbes != 0) {
|
||||
TCP_CLEAR_FLG (Tcb->CtrlFlag, TCP_CTRL_NO_KEEPALIVE);
|
||||
|
||||
Tcb->MaxKeepAlive = (UINT8) TCP_COMP_VAL (
|
||||
TCP_MAX_KEEPALIVE_MIN,
|
||||
TCP_MAX_KEEPALIVE,
|
||||
TCP_MAX_KEEPALIVE,
|
||||
Option->KeepAliveProbes
|
||||
);
|
||||
Tcb->MaxKeepAlive = (UINT8)TCP_COMP_VAL (
|
||||
TCP_MAX_KEEPALIVE_MIN,
|
||||
TCP_MAX_KEEPALIVE,
|
||||
TCP_MAX_KEEPALIVE,
|
||||
Option->KeepAliveProbes
|
||||
);
|
||||
Tcb->KeepAliveIdle = TCP_COMP_VAL (
|
||||
TCP_KEEPALIVE_IDLE_MIN,
|
||||
TCP_KEEPALIVE_IDLE_MAX,
|
||||
TCP_KEEPALIVE_IDLE_MIN,
|
||||
(UINT32) (Option->KeepAliveTime * TCP_TICK_HZ)
|
||||
(UINT32)(Option->KeepAliveTime * TCP_TICK_HZ)
|
||||
);
|
||||
Tcb->KeepAlivePeriod = TCP_COMP_VAL (
|
||||
TCP_KEEPALIVE_PERIOD_MIN,
|
||||
TCP_KEEPALIVE_PERIOD,
|
||||
TCP_KEEPALIVE_PERIOD,
|
||||
(UINT32) (Option->KeepAliveInterval * TCP_TICK_HZ)
|
||||
(UINT32)(Option->KeepAliveInterval * TCP_TICK_HZ)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -694,7 +689,7 @@ TcpConfigurePcb (
|
||||
TCP_CONNECT_TIME_MIN,
|
||||
TCP_CONNECT_TIME,
|
||||
TCP_CONNECT_TIME,
|
||||
(UINT32) (Option->ConnectionTimeout * TCP_TICK_HZ)
|
||||
(UINT32)(Option->ConnectionTimeout * TCP_TICK_HZ)
|
||||
);
|
||||
|
||||
if (!Option->EnableNagle) {
|
||||
@@ -724,19 +719,18 @@ TcpConfigurePcb (
|
||||
//
|
||||
if (((Sk->IpVersion == IP_VERSION_4) && !CfgData->Tcp4CfgData.AccessPoint.ActiveFlag) ||
|
||||
((Sk->IpVersion == IP_VERSION_6) && !CfgData->Tcp6CfgData.AccessPoint.ActiveFlag)
|
||||
) {
|
||||
|
||||
)
|
||||
{
|
||||
TcpSetState (Tcb, TCP_LISTEN);
|
||||
SockSetState (Sk, SO_LISTENING);
|
||||
|
||||
Sk->ConfigureState = SO_CONFIGURED_PASSIVE;
|
||||
} else {
|
||||
|
||||
Sk->ConfigureState = SO_CONFIGURED_ACTIVE;
|
||||
}
|
||||
|
||||
if (Sk->IpVersion == IP_VERSION_6) {
|
||||
Tcb->Tick = TCP6_REFRESH_NEIGHBOR_TICK;
|
||||
Tcb->Tick = TCP6_REFRESH_NEIGHBOR_TICK;
|
||||
|
||||
if (NetIp6IsUnspecifiedAddr (&Tcb->RemoteEnd.Ip.v6)) {
|
||||
Tcb->RemoteIpZero = TRUE;
|
||||
@@ -768,123 +762,121 @@ OnExit:
|
||||
**/
|
||||
EFI_STATUS
|
||||
TcpDispatcher (
|
||||
IN SOCKET *Sock,
|
||||
IN UINT8 Request,
|
||||
IN VOID *Data OPTIONAL
|
||||
IN SOCKET *Sock,
|
||||
IN UINT8 Request,
|
||||
IN VOID *Data OPTIONAL
|
||||
)
|
||||
{
|
||||
TCP_CB *Tcb;
|
||||
TCP_PROTO_DATA *ProtoData;
|
||||
|
||||
ProtoData = (TCP_PROTO_DATA *) Sock->ProtoReserved;
|
||||
ProtoData = (TCP_PROTO_DATA *)Sock->ProtoReserved;
|
||||
Tcb = ProtoData->TcpPcb;
|
||||
|
||||
switch (Request) {
|
||||
case SOCK_POLL:
|
||||
if (Tcb->Sk->IpVersion == IP_VERSION_4) {
|
||||
ProtoData->TcpService->IpIo->Ip.Ip4->Poll (ProtoData->TcpService->IpIo->Ip.Ip4);
|
||||
} else {
|
||||
ProtoData->TcpService->IpIo->Ip.Ip6->Poll (ProtoData->TcpService->IpIo->Ip.Ip6);
|
||||
}
|
||||
case SOCK_POLL:
|
||||
if (Tcb->Sk->IpVersion == IP_VERSION_4) {
|
||||
ProtoData->TcpService->IpIo->Ip.Ip4->Poll (ProtoData->TcpService->IpIo->Ip.Ip4);
|
||||
} else {
|
||||
ProtoData->TcpService->IpIo->Ip.Ip6->Poll (ProtoData->TcpService->IpIo->Ip.Ip6);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case SOCK_CONSUMED:
|
||||
//
|
||||
// After user received data from socket buffer, socket will
|
||||
// notify TCP using this message to give it a chance to send out
|
||||
// window update information
|
||||
//
|
||||
ASSERT (Tcb != NULL);
|
||||
TcpOnAppConsume (Tcb);
|
||||
break;
|
||||
case SOCK_CONSUMED:
|
||||
//
|
||||
// After user received data from socket buffer, socket will
|
||||
// notify TCP using this message to give it a chance to send out
|
||||
// window update information
|
||||
//
|
||||
ASSERT (Tcb != NULL);
|
||||
TcpOnAppConsume (Tcb);
|
||||
break;
|
||||
|
||||
case SOCK_SND:
|
||||
case SOCK_SND:
|
||||
|
||||
ASSERT (Tcb != NULL);
|
||||
TcpOnAppSend (Tcb);
|
||||
break;
|
||||
ASSERT (Tcb != NULL);
|
||||
TcpOnAppSend (Tcb);
|
||||
break;
|
||||
|
||||
case SOCK_CLOSE:
|
||||
case SOCK_CLOSE:
|
||||
|
||||
TcpOnAppClose (Tcb);
|
||||
TcpOnAppClose (Tcb);
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case SOCK_ABORT:
|
||||
case SOCK_ABORT:
|
||||
|
||||
TcpOnAppAbort (Tcb);
|
||||
TcpOnAppAbort (Tcb);
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case SOCK_SNDPUSH:
|
||||
Tcb->SndPsh = TcpGetMaxSndNxt (Tcb) + GET_SND_DATASIZE (Tcb->Sk);
|
||||
TCP_SET_FLG (Tcb->CtrlFlag, TCP_CTRL_SND_PSH);
|
||||
case SOCK_SNDPUSH:
|
||||
Tcb->SndPsh = TcpGetMaxSndNxt (Tcb) + GET_SND_DATASIZE (Tcb->Sk);
|
||||
TCP_SET_FLG (Tcb->CtrlFlag, TCP_CTRL_SND_PSH);
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case SOCK_SNDURG:
|
||||
Tcb->SndUp = TcpGetMaxSndNxt (Tcb) + GET_SND_DATASIZE (Tcb->Sk) - 1;
|
||||
TCP_SET_FLG (Tcb->CtrlFlag, TCP_CTRL_SND_URG);
|
||||
case SOCK_SNDURG:
|
||||
Tcb->SndUp = TcpGetMaxSndNxt (Tcb) + GET_SND_DATASIZE (Tcb->Sk) - 1;
|
||||
TCP_SET_FLG (Tcb->CtrlFlag, TCP_CTRL_SND_URG);
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case SOCK_CONNECT:
|
||||
case SOCK_CONNECT:
|
||||
|
||||
TcpOnAppConnect (Tcb);
|
||||
TcpOnAppConnect (Tcb);
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case SOCK_ATTACH:
|
||||
case SOCK_ATTACH:
|
||||
|
||||
return TcpAttachPcb (Sock);
|
||||
return TcpAttachPcb (Sock);
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case SOCK_FLUSH:
|
||||
case SOCK_FLUSH:
|
||||
|
||||
TcpFlushPcb (Tcb);
|
||||
TcpFlushPcb (Tcb);
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case SOCK_DETACH:
|
||||
case SOCK_DETACH:
|
||||
|
||||
TcpDetachPcb (Sock);
|
||||
TcpDetachPcb (Sock);
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case SOCK_CONFIGURE:
|
||||
case SOCK_CONFIGURE:
|
||||
|
||||
return TcpConfigurePcb (
|
||||
Sock,
|
||||
(TCP_CONFIG_DATA *) Data
|
||||
);
|
||||
return TcpConfigurePcb (
|
||||
Sock,
|
||||
(TCP_CONFIG_DATA *)Data
|
||||
);
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case SOCK_MODE:
|
||||
case SOCK_MODE:
|
||||
|
||||
ASSERT ((Data != NULL) && (Tcb != NULL));
|
||||
ASSERT ((Data != NULL) && (Tcb != NULL));
|
||||
|
||||
if (Tcb->Sk->IpVersion == IP_VERSION_4) {
|
||||
if (Tcb->Sk->IpVersion == IP_VERSION_4) {
|
||||
return Tcp4GetMode (Tcb, (TCP4_MODE_DATA *)Data);
|
||||
} else {
|
||||
return Tcp6GetMode (Tcb, (TCP6_MODE_DATA *)Data);
|
||||
}
|
||||
|
||||
return Tcp4GetMode (Tcb, (TCP4_MODE_DATA *) Data);
|
||||
} else {
|
||||
break;
|
||||
|
||||
return Tcp6GetMode (Tcb, (TCP6_MODE_DATA *) Data);
|
||||
}
|
||||
case SOCK_ROUTE:
|
||||
|
||||
break;
|
||||
ASSERT ((Data != NULL) && (Tcb != NULL) && (Tcb->Sk->IpVersion == IP_VERSION_4));
|
||||
|
||||
case SOCK_ROUTE:
|
||||
return Tcp4Route (Tcb, (TCP4_ROUTE_INFO *)Data);
|
||||
|
||||
ASSERT ((Data != NULL) && (Tcb != NULL) && (Tcb->Sk->IpVersion == IP_VERSION_4));
|
||||
default:
|
||||
|
||||
return Tcp4Route (Tcb, (TCP4_ROUTE_INFO *) Data);
|
||||
|
||||
default:
|
||||
|
||||
return EFI_UNSUPPORTED;
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
@@ -9,15 +9,15 @@
|
||||
|
||||
#include "TcpMain.h"
|
||||
|
||||
UINT16 mTcp4RandomPort;
|
||||
UINT16 mTcp6RandomPort;
|
||||
UINT16 mTcp4RandomPort;
|
||||
UINT16 mTcp6RandomPort;
|
||||
|
||||
TCP_HEARTBEAT_TIMER mTcpTimer = {
|
||||
TCP_HEARTBEAT_TIMER mTcpTimer = {
|
||||
NULL,
|
||||
0
|
||||
};
|
||||
|
||||
EFI_TCP4_PROTOCOL gTcp4ProtocolTemplate = {
|
||||
EFI_TCP4_PROTOCOL gTcp4ProtocolTemplate = {
|
||||
Tcp4GetModeData,
|
||||
Tcp4Configure,
|
||||
Tcp4Routes,
|
||||
@@ -30,7 +30,7 @@ EFI_TCP4_PROTOCOL gTcp4ProtocolTemplate = {
|
||||
Tcp4Poll
|
||||
};
|
||||
|
||||
EFI_TCP6_PROTOCOL gTcp6ProtocolTemplate = {
|
||||
EFI_TCP6_PROTOCOL gTcp6ProtocolTemplate = {
|
||||
Tcp6GetModeData,
|
||||
Tcp6Configure,
|
||||
Tcp6Connect,
|
||||
@@ -42,7 +42,7 @@ EFI_TCP6_PROTOCOL gTcp6ProtocolTemplate = {
|
||||
Tcp6Poll
|
||||
};
|
||||
|
||||
SOCK_INIT_DATA mTcpDefaultSockData = {
|
||||
SOCK_INIT_DATA mTcpDefaultSockData = {
|
||||
SockStream,
|
||||
SO_CLOSED,
|
||||
NULL,
|
||||
@@ -60,7 +60,7 @@ SOCK_INIT_DATA mTcpDefaultSockData = {
|
||||
NULL,
|
||||
};
|
||||
|
||||
EFI_DRIVER_BINDING_PROTOCOL gTcp4DriverBinding = {
|
||||
EFI_DRIVER_BINDING_PROTOCOL gTcp4DriverBinding = {
|
||||
Tcp4DriverBindingSupported,
|
||||
Tcp4DriverBindingStart,
|
||||
Tcp4DriverBindingStop,
|
||||
@@ -69,7 +69,7 @@ EFI_DRIVER_BINDING_PROTOCOL gTcp4DriverBinding = {
|
||||
NULL
|
||||
};
|
||||
|
||||
EFI_DRIVER_BINDING_PROTOCOL gTcp6DriverBinding = {
|
||||
EFI_DRIVER_BINDING_PROTOCOL gTcp6DriverBinding = {
|
||||
Tcp6DriverBindingSupported,
|
||||
Tcp6DriverBindingStart,
|
||||
Tcp6DriverBindingStop,
|
||||
@@ -83,7 +83,6 @@ EFI_SERVICE_BINDING_PROTOCOL gTcpServiceBinding = {
|
||||
TcpServiceBindingDestroyChild
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
Create and start the heartbeat timer for the TCP driver.
|
||||
|
||||
@@ -101,7 +100,6 @@ TcpCreateTimer (
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
if (mTcpTimer.RefCnt == 0) {
|
||||
|
||||
Status = gBS->CreateEvent (
|
||||
EVT_TIMER | EVT_NOTIFY_SIGNAL,
|
||||
TPL_NOTIFY,
|
||||
@@ -110,17 +108,15 @@ TcpCreateTimer (
|
||||
&mTcpTimer.TimerEvent
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
|
||||
Status = gBS->SetTimer (
|
||||
mTcpTimer.TimerEvent,
|
||||
TimerPeriodic,
|
||||
(UINT64) (TICKS_PER_SECOND / TCP_TICK_HZ)
|
||||
(UINT64)(TICKS_PER_SECOND / TCP_TICK_HZ)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
|
||||
mTcpTimer.RefCnt++;
|
||||
}
|
||||
|
||||
@@ -209,7 +205,7 @@ TcpDriverEntryPoint (
|
||||
//
|
||||
Seed = NetRandomInitSeed ();
|
||||
mTcpGlobalIss = NET_RANDOM (Seed) % mTcpGlobalIss;
|
||||
mTcp4RandomPort = (UINT16) (TCP_PORT_KNOWN + (NET_RANDOM (Seed) % TCP_PORT_KNOWN));
|
||||
mTcp4RandomPort = (UINT16)(TCP_PORT_KNOWN + (NET_RANDOM (Seed) % TCP_PORT_KNOWN));
|
||||
mTcp6RandomPort = mTcp4RandomPort;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
@@ -233,11 +229,11 @@ TcpCreateService (
|
||||
IN UINT8 IpVersion
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_GUID *IpServiceBindingGuid;
|
||||
EFI_GUID *TcpServiceBindingGuid;
|
||||
TCP_SERVICE_DATA *TcpServiceData;
|
||||
IP_IO_OPEN_DATA OpenData;
|
||||
EFI_STATUS Status;
|
||||
EFI_GUID *IpServiceBindingGuid;
|
||||
EFI_GUID *TcpServiceBindingGuid;
|
||||
TCP_SERVICE_DATA *TcpServiceData;
|
||||
IP_IO_OPEN_DATA OpenData;
|
||||
|
||||
if (IpVersion == IP_VERSION_4) {
|
||||
IpServiceBindingGuid = &gEfiIp4ServiceBindingProtocolGuid;
|
||||
@@ -279,10 +275,10 @@ TcpCreateService (
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
TcpServiceData->Signature = TCP_DRIVER_SIGNATURE;
|
||||
TcpServiceData->ControllerHandle = Controller;
|
||||
TcpServiceData->DriverBindingHandle = Image;
|
||||
TcpServiceData->IpVersion = IpVersion;
|
||||
TcpServiceData->Signature = TCP_DRIVER_SIGNATURE;
|
||||
TcpServiceData->ControllerHandle = Controller;
|
||||
TcpServiceData->DriverBindingHandle = Image;
|
||||
TcpServiceData->IpVersion = IpVersion;
|
||||
CopyMem (
|
||||
&TcpServiceData->ServiceBinding,
|
||||
&gTcpServiceBinding,
|
||||
@@ -295,7 +291,6 @@ TcpCreateService (
|
||||
goto ON_ERROR;
|
||||
}
|
||||
|
||||
|
||||
InitializeListHead (&TcpServiceData->SocketList);
|
||||
ZeroMem (&OpenData, sizeof (IP_IO_OPEN_DATA));
|
||||
|
||||
@@ -315,8 +310,8 @@ TcpCreateService (
|
||||
OpenData.IpConfigData.Ip6CfgData.DefaultProtocol = EFI_IP_PROTO_TCP;
|
||||
}
|
||||
|
||||
OpenData.PktRcvdNotify = TcpRxCallback;
|
||||
Status = IpIoOpen (TcpServiceData->IpIo, &OpenData);
|
||||
OpenData.PktRcvdNotify = TcpRxCallback;
|
||||
Status = IpIoOpen (TcpServiceData->IpIo, &OpenData);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto ON_ERROR;
|
||||
}
|
||||
@@ -365,8 +360,8 @@ ON_ERROR:
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
TcpDestroyChildEntryInHandleBuffer (
|
||||
IN LIST_ENTRY *Entry,
|
||||
IN VOID *Context
|
||||
IN LIST_ENTRY *Entry,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
SOCKET *Sock;
|
||||
@@ -374,14 +369,14 @@ TcpDestroyChildEntryInHandleBuffer (
|
||||
UINTN NumberOfChildren;
|
||||
EFI_HANDLE *ChildHandleBuffer;
|
||||
|
||||
if (Entry == NULL || Context == NULL) {
|
||||
if ((Entry == NULL) || (Context == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Sock = NET_LIST_USER_STRUCT_S (Entry, SOCKET, Link, SOCK_SIGNATURE);
|
||||
ServiceBinding = ((TCP_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->ServiceBinding;
|
||||
NumberOfChildren = ((TCP_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->NumberOfChildren;
|
||||
ChildHandleBuffer = ((TCP_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->ChildHandleBuffer;
|
||||
Sock = NET_LIST_USER_STRUCT_S (Entry, SOCKET, Link, SOCK_SIGNATURE);
|
||||
ServiceBinding = ((TCP_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *)Context)->ServiceBinding;
|
||||
NumberOfChildren = ((TCP_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *)Context)->NumberOfChildren;
|
||||
ChildHandleBuffer = ((TCP_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *)Context)->ChildHandleBuffer;
|
||||
|
||||
if (!NetIsInHandleBuffer (Sock->SockHandle, NumberOfChildren, ChildHandleBuffer)) {
|
||||
return EFI_SUCCESS;
|
||||
@@ -415,13 +410,13 @@ TcpDestroyService (
|
||||
IN UINT8 IpVersion
|
||||
)
|
||||
{
|
||||
EFI_HANDLE NicHandle;
|
||||
EFI_GUID *IpProtocolGuid;
|
||||
EFI_GUID *ServiceBindingGuid;
|
||||
EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
|
||||
TCP_SERVICE_DATA *TcpServiceData;
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *List;
|
||||
EFI_HANDLE NicHandle;
|
||||
EFI_GUID *IpProtocolGuid;
|
||||
EFI_GUID *ServiceBindingGuid;
|
||||
EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
|
||||
TCP_SERVICE_DATA *TcpServiceData;
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *List;
|
||||
TCP_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT Context;
|
||||
|
||||
ASSERT ((IpVersion == IP_VERSION_4) || (IpVersion == IP_VERSION_6));
|
||||
@@ -442,7 +437,7 @@ TcpDestroyService (
|
||||
Status = gBS->OpenProtocol (
|
||||
NicHandle,
|
||||
ServiceBindingGuid,
|
||||
(VOID **) &ServiceBinding,
|
||||
(VOID **)&ServiceBinding,
|
||||
ImageHandle,
|
||||
Controller,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
@@ -454,16 +449,16 @@ TcpDestroyService (
|
||||
TcpServiceData = TCP_SERVICE_FROM_THIS (ServiceBinding);
|
||||
|
||||
if (NumberOfChildren != 0) {
|
||||
List = &TcpServiceData->SocketList;
|
||||
Context.ServiceBinding = ServiceBinding;
|
||||
Context.NumberOfChildren = NumberOfChildren;
|
||||
List = &TcpServiceData->SocketList;
|
||||
Context.ServiceBinding = ServiceBinding;
|
||||
Context.NumberOfChildren = NumberOfChildren;
|
||||
Context.ChildHandleBuffer = ChildHandleBuffer;
|
||||
Status = NetDestroyLinkList (
|
||||
List,
|
||||
TcpDestroyChildEntryInHandleBuffer,
|
||||
&Context,
|
||||
NULL
|
||||
);
|
||||
Status = NetDestroyLinkList (
|
||||
List,
|
||||
TcpDestroyChildEntryInHandleBuffer,
|
||||
&Context,
|
||||
NULL
|
||||
);
|
||||
} else if (IsListEmpty (&TcpServiceData->SocketList)) {
|
||||
//
|
||||
// Uninstall TCP servicebinding protocol
|
||||
@@ -758,7 +753,7 @@ TcpCreateSocketCallback (
|
||||
IpProtocolGuid = &gEfiIp6ProtocolGuid;
|
||||
}
|
||||
|
||||
TcpServiceData = ((TCP_PROTO_DATA *) This->ProtoReserved)->TcpService;
|
||||
TcpServiceData = ((TCP_PROTO_DATA *)This->ProtoReserved)->TcpService;
|
||||
|
||||
//
|
||||
// Open the default IP protocol of IP_IO BY_DRIVER.
|
||||
@@ -781,7 +776,7 @@ TcpCreateSocketCallback (
|
||||
Status = gBS->OpenProtocol (
|
||||
TcpServiceData->ControllerHandle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
(VOID **) &This->ParentDevicePath,
|
||||
(VOID **)&This->ParentDevicePath,
|
||||
TcpServiceData->DriverBindingHandle,
|
||||
This->SockHandle,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
@@ -825,7 +820,7 @@ TcpDestroySocketCallback (
|
||||
IpProtocolGuid = &gEfiIp6ProtocolGuid;
|
||||
}
|
||||
|
||||
TcpServiceData = ((TCP_PROTO_DATA *) This->ProtoReserved)->TcpService;
|
||||
TcpServiceData = ((TCP_PROTO_DATA *)This->ProtoReserved)->TcpService;
|
||||
|
||||
//
|
||||
// Remove this node from the list.
|
||||
@@ -876,7 +871,7 @@ TcpServiceBindingCreateChild (
|
||||
EFI_STATUS Status;
|
||||
EFI_TPL OldTpl;
|
||||
|
||||
if (NULL == This || NULL == ChildHandle) {
|
||||
if ((NULL == This) || (NULL == ChildHandle)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -906,7 +901,7 @@ TcpServiceBindingCreateChild (
|
||||
if (NULL == Sock) {
|
||||
DEBUG (
|
||||
(DEBUG_ERROR,
|
||||
"TcpDriverBindingCreateChild: No resource to create a Tcp Child\n")
|
||||
"TcpDriverBindingCreateChild: No resource to create a Tcp Child\n")
|
||||
);
|
||||
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
@@ -914,7 +909,7 @@ TcpServiceBindingCreateChild (
|
||||
*ChildHandle = Sock->SockHandle;
|
||||
}
|
||||
|
||||
mTcpDefaultSockData.ProtoData = NULL;
|
||||
mTcpDefaultSockData.ProtoData = NULL;
|
||||
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
return Status;
|
||||
@@ -949,7 +944,7 @@ TcpServiceBindingDestroyChild (
|
||||
VOID *Tcp;
|
||||
SOCKET *Sock;
|
||||
|
||||
if (NULL == This || NULL == ChildHandle) {
|
||||
if ((NULL == This) || (NULL == ChildHandle)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
@@ -10,29 +10,29 @@
|
||||
#ifndef _TCP_DRIVER_H_
|
||||
#define _TCP_DRIVER_H_
|
||||
|
||||
#define TCP_DRIVER_SIGNATURE SIGNATURE_32 ('T', 'C', 'P', 'D')
|
||||
#define TCP_DRIVER_SIGNATURE SIGNATURE_32 ('T', 'C', 'P', 'D')
|
||||
|
||||
#define TCP_PORT_KNOWN 1024
|
||||
#define TCP_PORT_USER_RESERVED 65535
|
||||
#define TCP_PORT_KNOWN 1024
|
||||
#define TCP_PORT_USER_RESERVED 65535
|
||||
|
||||
typedef struct _TCP_HEARTBEAT_TIMER {
|
||||
EFI_EVENT TimerEvent;
|
||||
INTN RefCnt;
|
||||
EFI_EVENT TimerEvent;
|
||||
INTN RefCnt;
|
||||
} TCP_HEARTBEAT_TIMER;
|
||||
|
||||
typedef struct _TCP_SERVICE_DATA {
|
||||
UINT32 Signature;
|
||||
EFI_HANDLE ControllerHandle;
|
||||
EFI_HANDLE DriverBindingHandle;
|
||||
UINT8 IpVersion;
|
||||
IP_IO *IpIo;
|
||||
EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
|
||||
LIST_ENTRY SocketList;
|
||||
UINT32 Signature;
|
||||
EFI_HANDLE ControllerHandle;
|
||||
EFI_HANDLE DriverBindingHandle;
|
||||
UINT8 IpVersion;
|
||||
IP_IO *IpIo;
|
||||
EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
|
||||
LIST_ENTRY SocketList;
|
||||
} TCP_SERVICE_DATA;
|
||||
|
||||
typedef struct _TCP_PROTO_DATA {
|
||||
TCP_SERVICE_DATA *TcpService;
|
||||
TCP_CB *TcpPcb;
|
||||
TCP_SERVICE_DATA *TcpService;
|
||||
TCP_CB *TcpPcb;
|
||||
} TCP_PROTO_DATA;
|
||||
|
||||
#define TCP_SERVICE_FROM_THIS(a) \
|
||||
|
@@ -24,7 +24,7 @@
|
||||
typedef
|
||||
VOID
|
||||
(*TCP_TIMER_HANDLER) (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
);
|
||||
|
||||
//
|
||||
@@ -39,7 +39,7 @@ VOID
|
||||
**/
|
||||
VOID
|
||||
TcpInitTcbLocal (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -52,9 +52,9 @@ TcpInitTcbLocal (
|
||||
**/
|
||||
VOID
|
||||
TcpInitTcbPeer (
|
||||
IN OUT TCP_CB *Tcb,
|
||||
IN TCP_SEG *Seg,
|
||||
IN TCP_OPTION *Opt
|
||||
IN OUT TCP_CB *Tcb,
|
||||
IN TCP_SEG *Seg,
|
||||
IN TCP_OPTION *Opt
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -112,7 +112,7 @@ TcpLocateTcb (
|
||||
**/
|
||||
INTN
|
||||
TcpInsertTcb (
|
||||
IN TCP_CB *Tcb
|
||||
IN TCP_CB *Tcb
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -125,7 +125,7 @@ TcpInsertTcb (
|
||||
**/
|
||||
TCP_CB *
|
||||
TcpCloneTcb (
|
||||
IN TCP_CB *Tcb
|
||||
IN TCP_CB *Tcb
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -161,8 +161,8 @@ TcpGetRcvMss (
|
||||
**/
|
||||
VOID
|
||||
TcpSetState (
|
||||
IN TCP_CB *Tcb,
|
||||
IN UINT8 State
|
||||
IN TCP_CB *Tcb,
|
||||
IN UINT8 State
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -176,8 +176,8 @@ TcpSetState (
|
||||
**/
|
||||
UINT16
|
||||
TcpChecksum (
|
||||
IN NET_BUF *Nbuf,
|
||||
IN UINT16 HeadSum
|
||||
IN NET_BUF *Nbuf,
|
||||
IN UINT16 HeadSum
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -192,8 +192,8 @@ TcpChecksum (
|
||||
**/
|
||||
TCP_SEG *
|
||||
TcpFormatNetbuf (
|
||||
IN TCP_CB *Tcb,
|
||||
IN OUT NET_BUF *Nbuf
|
||||
IN TCP_CB *Tcb,
|
||||
IN OUT NET_BUF *Nbuf
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -217,7 +217,7 @@ TcpOnAppConnect (
|
||||
**/
|
||||
VOID
|
||||
TcpOnAppConsume (
|
||||
IN TCP_CB *Tcb
|
||||
IN TCP_CB *Tcb
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -229,7 +229,7 @@ TcpOnAppConsume (
|
||||
**/
|
||||
VOID
|
||||
TcpOnAppClose (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -244,7 +244,7 @@ TcpOnAppClose (
|
||||
**/
|
||||
INTN
|
||||
TcpOnAppSend (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -256,7 +256,7 @@ TcpOnAppSend (
|
||||
**/
|
||||
VOID
|
||||
TcpOnAppAbort (
|
||||
IN TCP_CB *Tcb
|
||||
IN TCP_CB *Tcb
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -267,7 +267,7 @@ TcpOnAppAbort (
|
||||
**/
|
||||
VOID
|
||||
TcpResetConnection (
|
||||
IN TCP_CB *Tcb
|
||||
IN TCP_CB *Tcb
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -281,10 +281,9 @@ TcpResetConnection (
|
||||
**/
|
||||
EFI_STATUS
|
||||
TcpInstallDevicePath (
|
||||
IN SOCKET *Sock
|
||||
IN SOCKET *Sock
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
// Functions in TcpOutput.c
|
||||
//
|
||||
@@ -299,7 +298,7 @@ TcpInstallDevicePath (
|
||||
**/
|
||||
UINT32
|
||||
TcpRcvWinOld (
|
||||
IN TCP_CB *Tcb
|
||||
IN TCP_CB *Tcb
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -312,7 +311,7 @@ TcpRcvWinOld (
|
||||
**/
|
||||
UINT32
|
||||
TcpRcvWinNow (
|
||||
IN TCP_CB *Tcb
|
||||
IN TCP_CB *Tcb
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -325,7 +324,7 @@ TcpRcvWinNow (
|
||||
**/
|
||||
TCP_SEQNO
|
||||
TcpGetMaxSndNxt (
|
||||
IN TCP_CB *Tcb
|
||||
IN TCP_CB *Tcb
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -340,8 +339,8 @@ TcpGetMaxSndNxt (
|
||||
**/
|
||||
UINT32
|
||||
TcpDataToSend (
|
||||
IN TCP_CB *Tcb,
|
||||
IN INTN Force
|
||||
IN TCP_CB *Tcb,
|
||||
IN INTN Force
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -356,8 +355,8 @@ TcpDataToSend (
|
||||
**/
|
||||
INTN
|
||||
TcpRetransmit (
|
||||
IN TCP_CB *Tcb,
|
||||
IN TCP_SEQNO Seq
|
||||
IN TCP_CB *Tcb,
|
||||
IN TCP_SEQNO Seq
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -372,8 +371,8 @@ TcpRetransmit (
|
||||
**/
|
||||
INTN
|
||||
TcpToSendData (
|
||||
IN OUT TCP_CB *Tcb,
|
||||
IN INTN Force
|
||||
IN OUT TCP_CB *Tcb,
|
||||
IN INTN Force
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -384,7 +383,7 @@ TcpToSendData (
|
||||
**/
|
||||
VOID
|
||||
TcpToSendAck (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -395,7 +394,7 @@ TcpToSendAck (
|
||||
**/
|
||||
VOID
|
||||
TcpSendAck (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -409,7 +408,7 @@ TcpSendAck (
|
||||
**/
|
||||
INTN
|
||||
TcpSendZeroProbe (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -448,7 +447,7 @@ TcpSendReset (
|
||||
**/
|
||||
INTN
|
||||
TcpVerifySegment (
|
||||
IN NET_BUF *Nbuf
|
||||
IN NET_BUF *Nbuf
|
||||
);
|
||||
|
||||
//
|
||||
@@ -511,7 +510,7 @@ TcpInput (
|
||||
**/
|
||||
VOID
|
||||
TcpClose (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -524,8 +523,8 @@ TcpClose (
|
||||
VOID
|
||||
EFIAPI
|
||||
TcpTicking (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -538,9 +537,9 @@ TcpTicking (
|
||||
**/
|
||||
VOID
|
||||
TcpSetTimer (
|
||||
IN OUT TCP_CB *Tcb,
|
||||
IN UINT16 Timer,
|
||||
IN UINT32 TimeOut
|
||||
IN OUT TCP_CB *Tcb,
|
||||
IN UINT16 Timer,
|
||||
IN UINT32 TimeOut
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -552,8 +551,8 @@ TcpSetTimer (
|
||||
**/
|
||||
VOID
|
||||
TcpClearTimer (
|
||||
IN OUT TCP_CB *Tcb,
|
||||
IN UINT16 Timer
|
||||
IN OUT TCP_CB *Tcb,
|
||||
IN UINT16 Timer
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -564,7 +563,7 @@ TcpClearTimer (
|
||||
**/
|
||||
VOID
|
||||
TcpClearAllTimer (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -575,7 +574,7 @@ TcpClearAllTimer (
|
||||
**/
|
||||
VOID
|
||||
TcpSetProbeTimer (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -586,7 +585,7 @@ TcpSetProbeTimer (
|
||||
**/
|
||||
VOID
|
||||
TcpSetKeepaliveTimer (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
);
|
||||
|
||||
//
|
||||
@@ -609,11 +608,11 @@ TcpSetKeepaliveTimer (
|
||||
VOID
|
||||
EFIAPI
|
||||
TcpRxCallback (
|
||||
IN EFI_STATUS Status,
|
||||
IN UINT8 IcmpErr,
|
||||
IN EFI_NET_SESSION_DATA *NetSession,
|
||||
IN NET_BUF *Pkt,
|
||||
IN VOID *Context OPTIONAL
|
||||
IN EFI_STATUS Status,
|
||||
IN UINT8 IcmpErr,
|
||||
IN EFI_NET_SESSION_DATA *NetSession,
|
||||
IN NET_BUF *Pkt,
|
||||
IN VOID *Context OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -685,9 +684,9 @@ Tcp6RefreshNeighbor (
|
||||
**/
|
||||
EFI_STATUS
|
||||
TcpDispatcher (
|
||||
IN SOCKET *Sock,
|
||||
IN UINT8 Request,
|
||||
IN VOID *Data OPTIONAL
|
||||
IN SOCKET *Sock,
|
||||
IN UINT8 Request,
|
||||
IN VOID *Data OPTIONAL
|
||||
);
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -25,11 +25,11 @@
|
||||
VOID
|
||||
EFIAPI
|
||||
TcpRxCallback (
|
||||
IN EFI_STATUS Status,
|
||||
IN UINT8 IcmpErr,
|
||||
IN EFI_NET_SESSION_DATA *NetSession,
|
||||
IN NET_BUF *Pkt,
|
||||
IN VOID *Context OPTIONAL
|
||||
IN EFI_STATUS Status,
|
||||
IN UINT8 IcmpErr,
|
||||
IN EFI_NET_SESSION_DATA *NetSession,
|
||||
IN NET_BUF *Pkt,
|
||||
IN VOID *Context OPTIONAL
|
||||
)
|
||||
{
|
||||
if (EFI_SUCCESS == Status) {
|
||||
@@ -67,15 +67,14 @@ TcpSendIpPacket (
|
||||
IN UINT8 Version
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
IP_IO *IpIo;
|
||||
IP_IO_OVERRIDE Override;
|
||||
SOCKET *Sock;
|
||||
VOID *IpSender;
|
||||
EFI_STATUS Status;
|
||||
IP_IO *IpIo;
|
||||
IP_IO_OVERRIDE Override;
|
||||
SOCKET *Sock;
|
||||
VOID *IpSender;
|
||||
TCP_PROTO_DATA *TcpProto;
|
||||
|
||||
if (NULL == Tcb) {
|
||||
|
||||
IpIo = NULL;
|
||||
IpSender = IpIoFindSender (&IpIo, Version, Src);
|
||||
|
||||
@@ -95,9 +94,8 @@ TcpSendIpPacket (
|
||||
IpSender = NULL;
|
||||
}
|
||||
} else {
|
||||
|
||||
Sock = Tcb->Sk;
|
||||
TcpProto = (TCP_PROTO_DATA *) Sock->ProtoReserved;
|
||||
TcpProto = (TCP_PROTO_DATA *)Sock->ProtoReserved;
|
||||
IpIo = TcpProto->TcpService->IpIo;
|
||||
IpSender = Tcb->IpInfo;
|
||||
|
||||
@@ -162,8 +160,8 @@ Tcp6RefreshNeighbor (
|
||||
IN UINT32 Timeout
|
||||
)
|
||||
{
|
||||
IP_IO *IpIo;
|
||||
SOCKET *Sock;
|
||||
IP_IO *IpIo;
|
||||
SOCKET *Sock;
|
||||
TCP_PROTO_DATA *TcpProto;
|
||||
|
||||
if (NULL == Tcb) {
|
||||
@@ -174,10 +172,9 @@ Tcp6RefreshNeighbor (
|
||||
DEBUG ((DEBUG_WARN, "Tcp6AddNeighbor: No appropriate IpIo.\n"));
|
||||
return EFI_NOT_STARTED;
|
||||
}
|
||||
|
||||
} else {
|
||||
Sock = Tcb->Sk;
|
||||
TcpProto = (TCP_PROTO_DATA *) Sock->ProtoReserved;
|
||||
TcpProto = (TCP_PROTO_DATA *)Sock->ProtoReserved;
|
||||
IpIo = TcpProto->TcpService->IpIo;
|
||||
}
|
||||
|
||||
|
@@ -24,19 +24,20 @@
|
||||
**/
|
||||
EFI_STATUS
|
||||
TcpChkDataBuf (
|
||||
IN UINT32 DataLen,
|
||||
IN UINT32 FragmentCount,
|
||||
IN EFI_TCP4_FRAGMENT_DATA *FragmentTable
|
||||
IN UINT32 DataLen,
|
||||
IN UINT32 FragmentCount,
|
||||
IN EFI_TCP4_FRAGMENT_DATA *FragmentTable
|
||||
)
|
||||
{
|
||||
UINT32 Index;
|
||||
UINT32 Index;
|
||||
|
||||
UINT32 Len;
|
||||
UINT32 Len;
|
||||
|
||||
for (Index = 0, Len = 0; Index < FragmentCount; Index++) {
|
||||
if (FragmentTable[Index].FragmentBuffer == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Len = Len + FragmentTable[Index].FragmentLength;
|
||||
}
|
||||
|
||||
@@ -73,12 +74,12 @@ TcpChkDataBuf (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp4GetModeData (
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
OUT EFI_TCP4_CONNECTION_STATE *Tcp4State OPTIONAL,
|
||||
OUT EFI_TCP4_CONFIG_DATA *Tcp4ConfigData OPTIONAL,
|
||||
OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL,
|
||||
OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
|
||||
OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
OUT EFI_TCP4_CONNECTION_STATE *Tcp4State OPTIONAL,
|
||||
OUT EFI_TCP4_CONFIG_DATA *Tcp4ConfigData OPTIONAL,
|
||||
OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL,
|
||||
OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
|
||||
OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
|
||||
)
|
||||
{
|
||||
TCP4_MODE_DATA TcpMode;
|
||||
@@ -88,13 +89,13 @@ Tcp4GetModeData (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Sock = SOCK_FROM_THIS (This);
|
||||
Sock = SOCK_FROM_THIS (This);
|
||||
|
||||
TcpMode.Tcp4State = Tcp4State;
|
||||
TcpMode.Tcp4ConfigData = Tcp4ConfigData;
|
||||
TcpMode.Ip4ModeData = Ip4ModeData;
|
||||
TcpMode.MnpConfigData = MnpConfigData;
|
||||
TcpMode.SnpModeData = SnpModeData;
|
||||
TcpMode.Tcp4State = Tcp4State;
|
||||
TcpMode.Tcp4ConfigData = Tcp4ConfigData;
|
||||
TcpMode.Ip4ModeData = Ip4ModeData;
|
||||
TcpMode.MnpConfigData = MnpConfigData;
|
||||
TcpMode.SnpModeData = SnpModeData;
|
||||
|
||||
return SockGetMode (Sock, &TcpMode);
|
||||
}
|
||||
@@ -124,8 +125,8 @@ Tcp4GetModeData (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp4Configure (
|
||||
IN EFI_TCP4_PROTOCOL * This,
|
||||
IN EFI_TCP4_CONFIG_DATA * TcpConfigData OPTIONAL
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
IN EFI_TCP4_CONFIG_DATA *TcpConfigData OPTIONAL
|
||||
)
|
||||
{
|
||||
EFI_TCP4_OPTION *Option;
|
||||
@@ -142,22 +143,21 @@ Tcp4Configure (
|
||||
// Tcp protocol related parameter check will be conducted here
|
||||
//
|
||||
if (NULL != TcpConfigData) {
|
||||
|
||||
CopyMem (&Ip, &TcpConfigData->AccessPoint.RemoteAddress, sizeof (IP4_ADDR));
|
||||
if (IP4_IS_LOCAL_BROADCAST (NTOHL (Ip))) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (TcpConfigData->AccessPoint.ActiveFlag && (0 == TcpConfigData->AccessPoint.RemotePort || (Ip == 0))) {
|
||||
if (TcpConfigData->AccessPoint.ActiveFlag && ((0 == TcpConfigData->AccessPoint.RemotePort) || (Ip == 0))) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (!TcpConfigData->AccessPoint.UseDefaultAddress) {
|
||||
|
||||
CopyMem (&Ip, &TcpConfigData->AccessPoint.StationAddress, sizeof (IP4_ADDR));
|
||||
CopyMem (&SubnetMask, &TcpConfigData->AccessPoint.SubnetMask, sizeof (IP4_ADDR));
|
||||
if (!IP4_IS_VALID_NETMASK (NTOHL (SubnetMask)) ||
|
||||
(SubnetMask != 0 && !NetIp4IsUnicast (NTOHL (Ip), NTOHL (SubnetMask)))) {
|
||||
((SubnetMask != 0) && !NetIp4IsUnicast (NTOHL (Ip), NTOHL (SubnetMask))))
|
||||
{
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
@@ -211,26 +211,26 @@ Tcp4Configure (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp4Routes (
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
IN BOOLEAN DeleteRoute,
|
||||
IN EFI_IPv4_ADDRESS *SubnetAddress,
|
||||
IN EFI_IPv4_ADDRESS *SubnetMask,
|
||||
IN EFI_IPv4_ADDRESS *GatewayAddress
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
IN BOOLEAN DeleteRoute,
|
||||
IN EFI_IPv4_ADDRESS *SubnetAddress,
|
||||
IN EFI_IPv4_ADDRESS *SubnetMask,
|
||||
IN EFI_IPv4_ADDRESS *GatewayAddress
|
||||
)
|
||||
{
|
||||
SOCKET *Sock;
|
||||
TCP4_ROUTE_INFO RouteInfo;
|
||||
SOCKET *Sock;
|
||||
TCP4_ROUTE_INFO RouteInfo;
|
||||
|
||||
if (NULL == This) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Sock = SOCK_FROM_THIS (This);
|
||||
Sock = SOCK_FROM_THIS (This);
|
||||
|
||||
RouteInfo.DeleteRoute = DeleteRoute;
|
||||
RouteInfo.SubnetAddress = SubnetAddress;
|
||||
RouteInfo.SubnetMask = SubnetMask;
|
||||
RouteInfo.GatewayAddress = GatewayAddress;
|
||||
RouteInfo.DeleteRoute = DeleteRoute;
|
||||
RouteInfo.SubnetAddress = SubnetAddress;
|
||||
RouteInfo.SubnetMask = SubnetMask;
|
||||
RouteInfo.GatewayAddress = GatewayAddress;
|
||||
|
||||
return SockRoute (Sock, &RouteInfo);
|
||||
}
|
||||
@@ -257,13 +257,13 @@ Tcp4Routes (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp4Connect (
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
IN EFI_TCP4_CONNECTION_TOKEN *ConnectionToken
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
IN EFI_TCP4_CONNECTION_TOKEN *ConnectionToken
|
||||
)
|
||||
{
|
||||
SOCKET *Sock;
|
||||
|
||||
if (NULL == This || NULL == ConnectionToken || NULL == ConnectionToken->CompletionToken.Event) {
|
||||
if ((NULL == This) || (NULL == ConnectionToken) || (NULL == ConnectionToken->CompletionToken.Event)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -295,13 +295,13 @@ Tcp4Connect (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp4Accept (
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
IN EFI_TCP4_LISTEN_TOKEN *ListenToken
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
IN EFI_TCP4_LISTEN_TOKEN *ListenToken
|
||||
)
|
||||
{
|
||||
SOCKET *Sock;
|
||||
|
||||
if (NULL == This || NULL == ListenToken || NULL == ListenToken->CompletionToken.Event) {
|
||||
if ((NULL == This) || (NULL == ListenToken) || (NULL == ListenToken->CompletionToken.Event)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -342,28 +342,29 @@ Tcp4Accept (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp4Transmit (
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
IN EFI_TCP4_IO_TOKEN *Token
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
IN EFI_TCP4_IO_TOKEN *Token
|
||||
)
|
||||
{
|
||||
SOCKET *Sock;
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (NULL == This ||
|
||||
NULL == Token ||
|
||||
NULL == Token->CompletionToken.Event ||
|
||||
NULL == Token->Packet.TxData ||
|
||||
0 == Token->Packet.TxData->FragmentCount ||
|
||||
0 == Token->Packet.TxData->DataLength
|
||||
) {
|
||||
if ((NULL == This) ||
|
||||
(NULL == Token) ||
|
||||
(NULL == Token->CompletionToken.Event) ||
|
||||
(NULL == Token->Packet.TxData) ||
|
||||
(0 == Token->Packet.TxData->FragmentCount) ||
|
||||
(0 == Token->Packet.TxData->DataLength)
|
||||
)
|
||||
{
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Status = TcpChkDataBuf (
|
||||
Token->Packet.TxData->DataLength,
|
||||
Token->Packet.TxData->FragmentCount,
|
||||
Token->Packet.TxData->FragmentTable
|
||||
);
|
||||
Token->Packet.TxData->DataLength,
|
||||
Token->Packet.TxData->FragmentCount,
|
||||
Token->Packet.TxData->FragmentTable
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
@@ -407,28 +408,29 @@ Tcp4Transmit (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp4Receive (
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
IN EFI_TCP4_IO_TOKEN *Token
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
IN EFI_TCP4_IO_TOKEN *Token
|
||||
)
|
||||
{
|
||||
SOCKET *Sock;
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (NULL == This ||
|
||||
NULL == Token ||
|
||||
NULL == Token->CompletionToken.Event ||
|
||||
NULL == Token->Packet.RxData ||
|
||||
0 == Token->Packet.RxData->FragmentCount ||
|
||||
0 == Token->Packet.RxData->DataLength
|
||||
) {
|
||||
if ((NULL == This) ||
|
||||
(NULL == Token) ||
|
||||
(NULL == Token->CompletionToken.Event) ||
|
||||
(NULL == Token->Packet.RxData) ||
|
||||
(0 == Token->Packet.RxData->FragmentCount) ||
|
||||
(0 == Token->Packet.RxData->DataLength)
|
||||
)
|
||||
{
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Status = TcpChkDataBuf (
|
||||
Token->Packet.RxData->DataLength,
|
||||
Token->Packet.RxData->FragmentCount,
|
||||
Token->Packet.RxData->FragmentTable
|
||||
);
|
||||
Token->Packet.RxData->DataLength,
|
||||
Token->Packet.RxData->FragmentCount,
|
||||
Token->Packet.RxData->FragmentTable
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
@@ -436,7 +438,6 @@ Tcp4Receive (
|
||||
Sock = SOCK_FROM_THIS (This);
|
||||
|
||||
return SockRcv (Sock, Token);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -464,13 +465,13 @@ Tcp4Receive (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp4Close (
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
IN EFI_TCP4_CLOSE_TOKEN *CloseToken
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
IN EFI_TCP4_CLOSE_TOKEN *CloseToken
|
||||
)
|
||||
{
|
||||
SOCKET *Sock;
|
||||
|
||||
if (NULL == This || NULL == CloseToken || NULL == CloseToken->CompletionToken.Event) {
|
||||
if ((NULL == This) || (NULL == CloseToken) || (NULL == CloseToken->CompletionToken.Event)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -506,8 +507,8 @@ Tcp4Close (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp4Cancel (
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
IN EFI_TCP4_COMPLETION_TOKEN *Token OPTIONAL
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
IN EFI_TCP4_COMPLETION_TOKEN *Token OPTIONAL
|
||||
)
|
||||
{
|
||||
SOCKET *Sock;
|
||||
@@ -538,7 +539,7 @@ Tcp4Cancel (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp4Poll (
|
||||
IN EFI_TCP4_PROTOCOL *This
|
||||
IN EFI_TCP4_PROTOCOL *This
|
||||
)
|
||||
{
|
||||
SOCKET *Sock;
|
||||
@@ -548,7 +549,7 @@ Tcp4Poll (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Sock = SOCK_FROM_THIS (This);
|
||||
Sock = SOCK_FROM_THIS (This);
|
||||
|
||||
Status = Sock->ProtoHandler (Sock, SOCK_POLL, NULL);
|
||||
|
||||
@@ -586,12 +587,12 @@ Tcp4Poll (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp6GetModeData (
|
||||
IN EFI_TCP6_PROTOCOL *This,
|
||||
OUT EFI_TCP6_CONNECTION_STATE *Tcp6State OPTIONAL,
|
||||
OUT EFI_TCP6_CONFIG_DATA *Tcp6ConfigData OPTIONAL,
|
||||
OUT EFI_IP6_MODE_DATA *Ip6ModeData OPTIONAL,
|
||||
OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
|
||||
OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
|
||||
IN EFI_TCP6_PROTOCOL *This,
|
||||
OUT EFI_TCP6_CONNECTION_STATE *Tcp6State OPTIONAL,
|
||||
OUT EFI_TCP6_CONFIG_DATA *Tcp6ConfigData OPTIONAL,
|
||||
OUT EFI_IP6_MODE_DATA *Ip6ModeData OPTIONAL,
|
||||
OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
|
||||
OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
|
||||
)
|
||||
{
|
||||
TCP6_MODE_DATA TcpMode;
|
||||
@@ -601,7 +602,7 @@ Tcp6GetModeData (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Sock = SOCK_FROM_THIS (This);
|
||||
Sock = SOCK_FROM_THIS (This);
|
||||
|
||||
TcpMode.Tcp6State = Tcp6State;
|
||||
TcpMode.Tcp6ConfigData = Tcp6ConfigData;
|
||||
@@ -662,8 +663,8 @@ Tcp6GetModeData (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp6Configure (
|
||||
IN EFI_TCP6_PROTOCOL *This,
|
||||
IN EFI_TCP6_CONFIG_DATA *Tcp6ConfigData OPTIONAL
|
||||
IN EFI_TCP6_PROTOCOL *This,
|
||||
IN EFI_TCP6_CONFIG_DATA *Tcp6ConfigData OPTIONAL
|
||||
)
|
||||
{
|
||||
EFI_TCP6_OPTION *Option;
|
||||
@@ -679,15 +680,15 @@ Tcp6Configure (
|
||||
// Tcp protocol related parameter check will be conducted here
|
||||
//
|
||||
if (NULL != Tcp6ConfigData) {
|
||||
|
||||
Ip = &Tcp6ConfigData->AccessPoint.RemoteAddress;
|
||||
if (!NetIp6IsUnspecifiedAddr (Ip) && !NetIp6IsValidUnicast (Ip)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (Tcp6ConfigData->AccessPoint.ActiveFlag &&
|
||||
(0 == Tcp6ConfigData->AccessPoint.RemotePort || NetIp6IsUnspecifiedAddr (Ip))
|
||||
) {
|
||||
((0 == Tcp6ConfigData->AccessPoint.RemotePort) || NetIp6IsUnspecifiedAddr (Ip))
|
||||
)
|
||||
{
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -750,13 +751,13 @@ Tcp6Configure (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp6Connect (
|
||||
IN EFI_TCP6_PROTOCOL *This,
|
||||
IN EFI_TCP6_CONNECTION_TOKEN *ConnectionToken
|
||||
IN EFI_TCP6_PROTOCOL *This,
|
||||
IN EFI_TCP6_CONNECTION_TOKEN *ConnectionToken
|
||||
)
|
||||
{
|
||||
SOCKET *Sock;
|
||||
|
||||
if (NULL == This || NULL == ConnectionToken || NULL == ConnectionToken->CompletionToken.Event) {
|
||||
if ((NULL == This) || (NULL == ConnectionToken) || (NULL == ConnectionToken->CompletionToken.Event)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -803,13 +804,13 @@ Tcp6Connect (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp6Accept (
|
||||
IN EFI_TCP6_PROTOCOL *This,
|
||||
IN EFI_TCP6_LISTEN_TOKEN *ListenToken
|
||||
IN EFI_TCP6_PROTOCOL *This,
|
||||
IN EFI_TCP6_LISTEN_TOKEN *ListenToken
|
||||
)
|
||||
{
|
||||
SOCKET *Sock;
|
||||
|
||||
if (NULL == This || NULL == ListenToken || NULL == ListenToken->CompletionToken.Event) {
|
||||
if ((NULL == This) || (NULL == ListenToken) || (NULL == ListenToken->CompletionToken.Event)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -858,28 +859,29 @@ Tcp6Accept (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp6Transmit (
|
||||
IN EFI_TCP6_PROTOCOL *This,
|
||||
IN EFI_TCP6_IO_TOKEN *Token
|
||||
IN EFI_TCP6_PROTOCOL *This,
|
||||
IN EFI_TCP6_IO_TOKEN *Token
|
||||
)
|
||||
{
|
||||
SOCKET *Sock;
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (NULL == This ||
|
||||
NULL == Token ||
|
||||
NULL == Token->CompletionToken.Event ||
|
||||
NULL == Token->Packet.TxData ||
|
||||
0 == Token->Packet.TxData->FragmentCount ||
|
||||
0 == Token->Packet.TxData->DataLength
|
||||
) {
|
||||
if ((NULL == This) ||
|
||||
(NULL == Token) ||
|
||||
(NULL == Token->CompletionToken.Event) ||
|
||||
(NULL == Token->Packet.TxData) ||
|
||||
(0 == Token->Packet.TxData->FragmentCount) ||
|
||||
(0 == Token->Packet.TxData->DataLength)
|
||||
)
|
||||
{
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Status = TcpChkDataBuf (
|
||||
Token->Packet.TxData->DataLength,
|
||||
Token->Packet.TxData->FragmentCount,
|
||||
(EFI_TCP4_FRAGMENT_DATA *) Token->Packet.TxData->FragmentTable
|
||||
);
|
||||
Token->Packet.TxData->DataLength,
|
||||
Token->Packet.TxData->FragmentCount,
|
||||
(EFI_TCP4_FRAGMENT_DATA *)Token->Packet.TxData->FragmentTable
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
@@ -938,28 +940,29 @@ Tcp6Transmit (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp6Receive (
|
||||
IN EFI_TCP6_PROTOCOL *This,
|
||||
IN EFI_TCP6_IO_TOKEN *Token
|
||||
IN EFI_TCP6_PROTOCOL *This,
|
||||
IN EFI_TCP6_IO_TOKEN *Token
|
||||
)
|
||||
{
|
||||
SOCKET *Sock;
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (NULL == This ||
|
||||
NULL == Token ||
|
||||
NULL == Token->CompletionToken.Event ||
|
||||
NULL == Token->Packet.RxData ||
|
||||
0 == Token->Packet.RxData->FragmentCount ||
|
||||
0 == Token->Packet.RxData->DataLength
|
||||
) {
|
||||
if ((NULL == This) ||
|
||||
(NULL == Token) ||
|
||||
(NULL == Token->CompletionToken.Event) ||
|
||||
(NULL == Token->Packet.RxData) ||
|
||||
(0 == Token->Packet.RxData->FragmentCount) ||
|
||||
(0 == Token->Packet.RxData->DataLength)
|
||||
)
|
||||
{
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Status = TcpChkDataBuf (
|
||||
Token->Packet.RxData->DataLength,
|
||||
Token->Packet.RxData->FragmentCount,
|
||||
(EFI_TCP4_FRAGMENT_DATA *) Token->Packet.RxData->FragmentTable
|
||||
);
|
||||
Token->Packet.RxData->DataLength,
|
||||
Token->Packet.RxData->FragmentCount,
|
||||
(EFI_TCP4_FRAGMENT_DATA *)Token->Packet.RxData->FragmentTable
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
@@ -999,13 +1002,13 @@ Tcp6Receive (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp6Close (
|
||||
IN EFI_TCP6_PROTOCOL *This,
|
||||
IN EFI_TCP6_CLOSE_TOKEN *CloseToken
|
||||
IN EFI_TCP6_PROTOCOL *This,
|
||||
IN EFI_TCP6_CLOSE_TOKEN *CloseToken
|
||||
)
|
||||
{
|
||||
SOCKET *Sock;
|
||||
|
||||
if (NULL == This || NULL == CloseToken || NULL == CloseToken->CompletionToken.Event) {
|
||||
if ((NULL == This) || (NULL == CloseToken) || (NULL == CloseToken->CompletionToken.Event)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -1052,8 +1055,8 @@ Tcp6Close (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp6Cancel (
|
||||
IN EFI_TCP6_PROTOCOL *This,
|
||||
IN EFI_TCP6_COMPLETION_TOKEN *Token OPTIONAL
|
||||
IN EFI_TCP6_PROTOCOL *This,
|
||||
IN EFI_TCP6_COMPLETION_TOKEN *Token OPTIONAL
|
||||
)
|
||||
{
|
||||
SOCKET *Sock;
|
||||
@@ -1087,7 +1090,7 @@ Tcp6Cancel (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp6Poll (
|
||||
IN EFI_TCP6_PROTOCOL *This
|
||||
IN EFI_TCP6_PROTOCOL *This
|
||||
)
|
||||
{
|
||||
SOCKET *Sock;
|
||||
@@ -1097,10 +1100,9 @@ Tcp6Poll (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Sock = SOCK_FROM_THIS (This);
|
||||
Sock = SOCK_FROM_THIS (This);
|
||||
|
||||
Status = Sock->ProtoHandler (Sock, SOCK_POLL, NULL);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@@ -29,67 +29,67 @@ extern EFI_COMPONENT_NAME_PROTOCOL gTcpComponentName;
|
||||
extern EFI_COMPONENT_NAME2_PROTOCOL gTcpComponentName2;
|
||||
extern EFI_UNICODE_STRING_TABLE *gTcpControllerNameTable;
|
||||
|
||||
extern LIST_ENTRY mTcpRunQue;
|
||||
extern LIST_ENTRY mTcpListenQue;
|
||||
extern TCP_SEQNO mTcpGlobalIss;
|
||||
extern UINT32 mTcpTick;
|
||||
extern LIST_ENTRY mTcpRunQue;
|
||||
extern LIST_ENTRY mTcpListenQue;
|
||||
extern TCP_SEQNO mTcpGlobalIss;
|
||||
extern UINT32 mTcpTick;
|
||||
|
||||
///
|
||||
/// 30 seconds.
|
||||
///
|
||||
#define TCP6_KEEP_NEIGHBOR_TIME 30
|
||||
#define TCP6_KEEP_NEIGHBOR_TIME 30
|
||||
///
|
||||
/// 5 seconds, since 1 tick equals 200ms.
|
||||
///
|
||||
#define TCP6_REFRESH_NEIGHBOR_TICK 25
|
||||
#define TCP6_REFRESH_NEIGHBOR_TICK 25
|
||||
|
||||
#define TCP_EXPIRE_TIME 65535
|
||||
#define TCP_EXPIRE_TIME 65535
|
||||
|
||||
///
|
||||
/// The implementation selects the initial send sequence number and the unit to
|
||||
/// be added when it is increased.
|
||||
///
|
||||
#define TCP_BASE_ISS 0x4d7e980b
|
||||
#define TCP_ISS_INCREMENT_1 2048
|
||||
#define TCP_ISS_INCREMENT_2 100
|
||||
#define TCP_BASE_ISS 0x4d7e980b
|
||||
#define TCP_ISS_INCREMENT_1 2048
|
||||
#define TCP_ISS_INCREMENT_2 100
|
||||
|
||||
typedef union {
|
||||
EFI_TCP4_CONFIG_DATA Tcp4CfgData;
|
||||
EFI_TCP6_CONFIG_DATA Tcp6CfgData;
|
||||
EFI_TCP4_CONFIG_DATA Tcp4CfgData;
|
||||
EFI_TCP6_CONFIG_DATA Tcp6CfgData;
|
||||
} TCP_CONFIG_DATA;
|
||||
|
||||
typedef union {
|
||||
EFI_TCP4_ACCESS_POINT Tcp4Ap;
|
||||
EFI_TCP6_ACCESS_POINT Tcp6Ap;
|
||||
EFI_TCP4_ACCESS_POINT Tcp4Ap;
|
||||
EFI_TCP6_ACCESS_POINT Tcp6Ap;
|
||||
} TCP_ACCESS_POINT;
|
||||
|
||||
typedef struct _TCP4_MODE_DATA {
|
||||
EFI_TCP4_CONNECTION_STATE *Tcp4State;
|
||||
EFI_TCP4_CONFIG_DATA *Tcp4ConfigData;
|
||||
EFI_IP4_MODE_DATA *Ip4ModeData;
|
||||
EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData;
|
||||
EFI_SIMPLE_NETWORK_MODE *SnpModeData;
|
||||
EFI_TCP4_CONNECTION_STATE *Tcp4State;
|
||||
EFI_TCP4_CONFIG_DATA *Tcp4ConfigData;
|
||||
EFI_IP4_MODE_DATA *Ip4ModeData;
|
||||
EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData;
|
||||
EFI_SIMPLE_NETWORK_MODE *SnpModeData;
|
||||
} TCP4_MODE_DATA;
|
||||
|
||||
typedef struct _TCP6_MODE_DATA {
|
||||
EFI_TCP6_CONNECTION_STATE *Tcp6State;
|
||||
EFI_TCP6_CONFIG_DATA *Tcp6ConfigData;
|
||||
EFI_IP6_MODE_DATA *Ip6ModeData;
|
||||
EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData;
|
||||
EFI_SIMPLE_NETWORK_MODE *SnpModeData;
|
||||
EFI_TCP6_CONNECTION_STATE *Tcp6State;
|
||||
EFI_TCP6_CONFIG_DATA *Tcp6ConfigData;
|
||||
EFI_IP6_MODE_DATA *Ip6ModeData;
|
||||
EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData;
|
||||
EFI_SIMPLE_NETWORK_MODE *SnpModeData;
|
||||
} TCP6_MODE_DATA;
|
||||
|
||||
typedef struct _TCP4_ROUTE_INFO {
|
||||
BOOLEAN DeleteRoute;
|
||||
EFI_IPv4_ADDRESS *SubnetAddress;
|
||||
EFI_IPv4_ADDRESS *SubnetMask;
|
||||
EFI_IPv4_ADDRESS *GatewayAddress;
|
||||
BOOLEAN DeleteRoute;
|
||||
EFI_IPv4_ADDRESS *SubnetAddress;
|
||||
EFI_IPv4_ADDRESS *SubnetMask;
|
||||
EFI_IPv4_ADDRESS *GatewayAddress;
|
||||
} TCP4_ROUTE_INFO;
|
||||
|
||||
typedef struct {
|
||||
EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
|
||||
UINTN NumberOfChildren;
|
||||
EFI_HANDLE *ChildHandleBuffer;
|
||||
EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
|
||||
UINTN NumberOfChildren;
|
||||
EFI_HANDLE *ChildHandleBuffer;
|
||||
} TCP_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT;
|
||||
|
||||
//
|
||||
@@ -122,12 +122,12 @@ typedef struct {
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp4GetModeData (
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
OUT EFI_TCP4_CONNECTION_STATE *Tcp4State OPTIONAL,
|
||||
OUT EFI_TCP4_CONFIG_DATA *Tcp4ConfigData OPTIONAL,
|
||||
OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL,
|
||||
OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
|
||||
OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
OUT EFI_TCP4_CONNECTION_STATE *Tcp4State OPTIONAL,
|
||||
OUT EFI_TCP4_CONFIG_DATA *Tcp4ConfigData OPTIONAL,
|
||||
OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL,
|
||||
OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
|
||||
OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -155,8 +155,8 @@ Tcp4GetModeData (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp4Configure (
|
||||
IN EFI_TCP4_PROTOCOL * This,
|
||||
IN EFI_TCP4_CONFIG_DATA * TcpConfigData OPTIONAL
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
IN EFI_TCP4_CONFIG_DATA *TcpConfigData OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -187,11 +187,11 @@ Tcp4Configure (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp4Routes (
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
IN BOOLEAN DeleteRoute,
|
||||
IN EFI_IPv4_ADDRESS *SubnetAddress,
|
||||
IN EFI_IPv4_ADDRESS *SubnetMask,
|
||||
IN EFI_IPv4_ADDRESS *GatewayAddress
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
IN BOOLEAN DeleteRoute,
|
||||
IN EFI_IPv4_ADDRESS *SubnetAddress,
|
||||
IN EFI_IPv4_ADDRESS *SubnetMask,
|
||||
IN EFI_IPv4_ADDRESS *GatewayAddress
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -216,8 +216,8 @@ Tcp4Routes (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp4Connect (
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
IN EFI_TCP4_CONNECTION_TOKEN *ConnectionToken
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
IN EFI_TCP4_CONNECTION_TOKEN *ConnectionToken
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -243,8 +243,8 @@ Tcp4Connect (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp4Accept (
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
IN EFI_TCP4_LISTEN_TOKEN *ListenToken
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
IN EFI_TCP4_LISTEN_TOKEN *ListenToken
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -279,8 +279,8 @@ Tcp4Accept (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp4Transmit (
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
IN EFI_TCP4_IO_TOKEN *Token
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
IN EFI_TCP4_IO_TOKEN *Token
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -317,8 +317,8 @@ Tcp4Transmit (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp4Receive (
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
IN EFI_TCP4_IO_TOKEN *Token
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
IN EFI_TCP4_IO_TOKEN *Token
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -346,8 +346,8 @@ Tcp4Receive (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp4Close (
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
IN EFI_TCP4_CLOSE_TOKEN *CloseToken
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
IN EFI_TCP4_CLOSE_TOKEN *CloseToken
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -377,8 +377,8 @@ Tcp4Close (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp4Cancel (
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
IN EFI_TCP4_COMPLETION_TOKEN *Token OPTIONAL
|
||||
IN EFI_TCP4_PROTOCOL *This,
|
||||
IN EFI_TCP4_COMPLETION_TOKEN *Token OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -398,7 +398,7 @@ Tcp4Cancel (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp4Poll (
|
||||
IN EFI_TCP4_PROTOCOL *This
|
||||
IN EFI_TCP4_PROTOCOL *This
|
||||
);
|
||||
|
||||
//
|
||||
@@ -436,12 +436,12 @@ Tcp4Poll (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp6GetModeData (
|
||||
IN EFI_TCP6_PROTOCOL *This,
|
||||
OUT EFI_TCP6_CONNECTION_STATE *Tcp6State OPTIONAL,
|
||||
OUT EFI_TCP6_CONFIG_DATA *Tcp6ConfigData OPTIONAL,
|
||||
OUT EFI_IP6_MODE_DATA *Ip6ModeData OPTIONAL,
|
||||
OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
|
||||
OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
|
||||
IN EFI_TCP6_PROTOCOL *This,
|
||||
OUT EFI_TCP6_CONNECTION_STATE *Tcp6State OPTIONAL,
|
||||
OUT EFI_TCP6_CONFIG_DATA *Tcp6ConfigData OPTIONAL,
|
||||
OUT EFI_IP6_MODE_DATA *Ip6ModeData OPTIONAL,
|
||||
OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
|
||||
OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -494,8 +494,8 @@ Tcp6GetModeData (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp6Configure (
|
||||
IN EFI_TCP6_PROTOCOL *This,
|
||||
IN EFI_TCP6_CONFIG_DATA *Tcp6ConfigData OPTIONAL
|
||||
IN EFI_TCP6_PROTOCOL *This,
|
||||
IN EFI_TCP6_CONFIG_DATA *Tcp6ConfigData OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -531,8 +531,8 @@ Tcp6Configure (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp6Connect (
|
||||
IN EFI_TCP6_PROTOCOL *This,
|
||||
IN EFI_TCP6_CONNECTION_TOKEN *ConnectionToken
|
||||
IN EFI_TCP6_PROTOCOL *This,
|
||||
IN EFI_TCP6_CONNECTION_TOKEN *ConnectionToken
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -574,8 +574,8 @@ Tcp6Connect (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp6Accept (
|
||||
IN EFI_TCP6_PROTOCOL *This,
|
||||
IN EFI_TCP6_LISTEN_TOKEN *ListenToken
|
||||
IN EFI_TCP6_PROTOCOL *This,
|
||||
IN EFI_TCP6_LISTEN_TOKEN *ListenToken
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -618,8 +618,8 @@ Tcp6Accept (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp6Transmit (
|
||||
IN EFI_TCP6_PROTOCOL *This,
|
||||
IN EFI_TCP6_IO_TOKEN *Token
|
||||
IN EFI_TCP6_PROTOCOL *This,
|
||||
IN EFI_TCP6_IO_TOKEN *Token
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -671,8 +671,8 @@ Tcp6Transmit (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp6Receive (
|
||||
IN EFI_TCP6_PROTOCOL *This,
|
||||
IN EFI_TCP6_IO_TOKEN *Token
|
||||
IN EFI_TCP6_PROTOCOL *This,
|
||||
IN EFI_TCP6_IO_TOKEN *Token
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -705,8 +705,8 @@ Tcp6Receive (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp6Close (
|
||||
IN EFI_TCP6_PROTOCOL *This,
|
||||
IN EFI_TCP6_CLOSE_TOKEN *CloseToken
|
||||
IN EFI_TCP6_PROTOCOL *This,
|
||||
IN EFI_TCP6_CLOSE_TOKEN *CloseToken
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -747,8 +747,8 @@ Tcp6Close (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp6Cancel (
|
||||
IN EFI_TCP6_PROTOCOL *This,
|
||||
IN EFI_TCP6_COMPLETION_TOKEN *Token OPTIONAL
|
||||
IN EFI_TCP6_PROTOCOL *This,
|
||||
IN EFI_TCP6_COMPLETION_TOKEN *Token OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -771,7 +771,7 @@ Tcp6Cancel (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tcp6Poll (
|
||||
IN EFI_TCP6_PROTOCOL *This
|
||||
IN EFI_TCP6_PROTOCOL *This
|
||||
);
|
||||
|
||||
#endif
|
||||
|
@@ -10,19 +10,19 @@
|
||||
|
||||
#include "TcpMain.h"
|
||||
|
||||
LIST_ENTRY mTcpRunQue = {
|
||||
LIST_ENTRY mTcpRunQue = {
|
||||
&mTcpRunQue,
|
||||
&mTcpRunQue
|
||||
};
|
||||
|
||||
LIST_ENTRY mTcpListenQue = {
|
||||
LIST_ENTRY mTcpListenQue = {
|
||||
&mTcpListenQue,
|
||||
&mTcpListenQue
|
||||
};
|
||||
|
||||
TCP_SEQNO mTcpGlobalIss = TCP_BASE_ISS;
|
||||
TCP_SEQNO mTcpGlobalIss = TCP_BASE_ISS;
|
||||
|
||||
CHAR16 *mTcpStateName[] = {
|
||||
CHAR16 *mTcpStateName[] = {
|
||||
L"TCP_CLOSED",
|
||||
L"TCP_LISTEN",
|
||||
L"TCP_SYN_SENT",
|
||||
@@ -36,7 +36,6 @@ CHAR16 *mTcpStateName[] = {
|
||||
L"TCP_LAST_ACK"
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
Initialize the Tcb local related members.
|
||||
|
||||
@@ -45,7 +44,7 @@ CHAR16 *mTcpStateName[] = {
|
||||
**/
|
||||
VOID
|
||||
TcpInitTcbLocal (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -53,18 +52,18 @@ TcpInitTcbLocal (
|
||||
//
|
||||
if (Tcb->Sk->IpVersion == IP_VERSION_4) {
|
||||
Tcb->HeadSum = NetPseudoHeadChecksum (
|
||||
Tcb->LocalEnd.Ip.Addr[0],
|
||||
Tcb->RemoteEnd.Ip.Addr[0],
|
||||
0x06,
|
||||
0
|
||||
);
|
||||
Tcb->LocalEnd.Ip.Addr[0],
|
||||
Tcb->RemoteEnd.Ip.Addr[0],
|
||||
0x06,
|
||||
0
|
||||
);
|
||||
} else {
|
||||
Tcb->HeadSum = NetIp6PseudoHeadChecksum (
|
||||
&Tcb->LocalEnd.Ip.v6,
|
||||
&Tcb->RemoteEnd.Ip.v6,
|
||||
0x06,
|
||||
0
|
||||
);
|
||||
&Tcb->LocalEnd.Ip.v6,
|
||||
&Tcb->RemoteEnd.Ip.v6,
|
||||
0x06,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
Tcb->Iss = TcpGetIss ();
|
||||
@@ -79,7 +78,7 @@ TcpInitTcbLocal (
|
||||
//
|
||||
// First window size is never scaled
|
||||
//
|
||||
Tcb->RcvWndScale = 0;
|
||||
Tcb->RcvWndScale = 0;
|
||||
Tcb->RetxmitSeqMax = 0;
|
||||
|
||||
Tcb->ProbeTimerOn = FALSE;
|
||||
@@ -95,9 +94,9 @@ TcpInitTcbLocal (
|
||||
**/
|
||||
VOID
|
||||
TcpInitTcbPeer (
|
||||
IN OUT TCP_CB *Tcb,
|
||||
IN TCP_SEG *Seg,
|
||||
IN TCP_OPTION *Opt
|
||||
IN OUT TCP_CB *Tcb,
|
||||
IN TCP_SEG *Seg,
|
||||
IN TCP_OPTION *Opt
|
||||
)
|
||||
{
|
||||
UINT16 RcvMss;
|
||||
@@ -105,9 +104,9 @@ TcpInitTcbPeer (
|
||||
ASSERT ((Tcb != NULL) && (Seg != NULL) && (Opt != NULL));
|
||||
ASSERT (TCP_FLG_ON (Seg->Flag, TCP_FLG_SYN));
|
||||
|
||||
Tcb->SndWnd = Seg->Wnd;
|
||||
Tcb->SndWndMax = Tcb->SndWnd;
|
||||
Tcb->SndWl1 = Seg->Seq;
|
||||
Tcb->SndWnd = Seg->Wnd;
|
||||
Tcb->SndWndMax = Tcb->SndWnd;
|
||||
Tcb->SndWl1 = Seg->Seq;
|
||||
|
||||
if (TCP_FLG_ON (Seg->Flag, TCP_FLG_ACK)) {
|
||||
Tcb->SndWl2 = Seg->Ack;
|
||||
@@ -116,13 +115,12 @@ TcpInitTcbPeer (
|
||||
}
|
||||
|
||||
if (TCP_FLG_ON (Opt->Flag, TCP_OPTION_RCVD_MSS)) {
|
||||
Tcb->SndMss = (UINT16) MAX (64, Opt->Mss);
|
||||
Tcb->SndMss = (UINT16)MAX (64, Opt->Mss);
|
||||
|
||||
RcvMss = TcpGetRcvMss (Tcb->Sk);
|
||||
RcvMss = TcpGetRcvMss (Tcb->Sk);
|
||||
if (Tcb->SndMss > RcvMss) {
|
||||
Tcb->SndMss = RcvMss;
|
||||
}
|
||||
|
||||
} else {
|
||||
//
|
||||
// One end doesn't support MSS option, use default.
|
||||
@@ -130,7 +128,7 @@ TcpInitTcbPeer (
|
||||
Tcb->RcvMss = 536;
|
||||
}
|
||||
|
||||
Tcb->CWnd = Tcb->SndMss;
|
||||
Tcb->CWnd = Tcb->SndMss;
|
||||
|
||||
Tcb->Irs = Seg->Seq;
|
||||
Tcb->RcvNxt = Tcb->Irs + 1;
|
||||
@@ -138,12 +136,10 @@ TcpInitTcbPeer (
|
||||
Tcb->RcvWl2 = Tcb->RcvNxt;
|
||||
|
||||
if (TCP_FLG_ON (Opt->Flag, TCP_OPTION_RCVD_WS) && !TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_NO_WS)) {
|
||||
Tcb->SndWndScale = Opt->WndScale;
|
||||
|
||||
Tcb->SndWndScale = Opt->WndScale;
|
||||
|
||||
Tcb->RcvWndScale = TcpComputeScale (Tcb);
|
||||
Tcb->RcvWndScale = TcpComputeScale (Tcb);
|
||||
TCP_SET_FLG (Tcb->CtrlFlag, TCP_CTRL_RCVD_WS);
|
||||
|
||||
} else {
|
||||
//
|
||||
// One end doesn't support window scale option. use zero.
|
||||
@@ -152,7 +148,6 @@ TcpInitTcbPeer (
|
||||
}
|
||||
|
||||
if (TCP_FLG_ON (Opt->Flag, TCP_OPTION_RCVD_TS) && !TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_NO_TS)) {
|
||||
|
||||
TCP_SET_FLG (Tcb->CtrlFlag, TCP_CTRL_SND_TS);
|
||||
TCP_SET_FLG (Tcb->CtrlFlag, TCP_CTRL_RCVD_TS);
|
||||
|
||||
@@ -189,9 +184,9 @@ TcpIsIpEqual (
|
||||
ASSERT ((Version == IP_VERSION_4) || (Version == IP_VERSION_6));
|
||||
|
||||
if (Version == IP_VERSION_4) {
|
||||
return (BOOLEAN) (Ip1->Addr[0] == Ip2->Addr[0]);
|
||||
return (BOOLEAN)(Ip1->Addr[0] == Ip2->Addr[0]);
|
||||
} else {
|
||||
return (BOOLEAN) EFI_IP6_EQUAL (&Ip1->v6, &Ip2->v6);
|
||||
return (BOOLEAN)EFI_IP6_EQUAL (&Ip1->v6, &Ip2->v6);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,17 +203,17 @@ TcpIsIpEqual (
|
||||
**/
|
||||
BOOLEAN
|
||||
TcpIsIpZero (
|
||||
IN EFI_IP_ADDRESS *Ip,
|
||||
IN UINT8 Version
|
||||
IN EFI_IP_ADDRESS *Ip,
|
||||
IN UINT8 Version
|
||||
)
|
||||
{
|
||||
ASSERT ((Version == IP_VERSION_4) || (Version == IP_VERSION_6));
|
||||
|
||||
if (Version == IP_VERSION_4) {
|
||||
return (BOOLEAN) (Ip->Addr[0] == 0);
|
||||
return (BOOLEAN)(Ip->Addr[0] == 0);
|
||||
} else {
|
||||
return (BOOLEAN) ((Ip->Addr[0] == 0) && (Ip->Addr[1] == 0) &&
|
||||
(Ip->Addr[2] == 0) && (Ip->Addr[3] == 0));
|
||||
return (BOOLEAN)((Ip->Addr[0] == 0) && (Ip->Addr[1] == 0) &&
|
||||
(Ip->Addr[2] == 0) && (Ip->Addr[3] == 0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,16 +231,16 @@ TcpIsIpZero (
|
||||
**/
|
||||
TCP_CB *
|
||||
TcpLocateListenTcb (
|
||||
IN TCP_PEER *Local,
|
||||
IN TCP_PEER *Remote,
|
||||
IN UINT8 Version
|
||||
IN TCP_PEER *Local,
|
||||
IN TCP_PEER *Remote,
|
||||
IN UINT8 Version
|
||||
)
|
||||
{
|
||||
LIST_ENTRY *Entry;
|
||||
TCP_CB *Node;
|
||||
TCP_CB *Match;
|
||||
INTN Last;
|
||||
INTN Cur;
|
||||
LIST_ENTRY *Entry;
|
||||
TCP_CB *Node;
|
||||
TCP_CB *Match;
|
||||
INTN Last;
|
||||
INTN Cur;
|
||||
|
||||
Last = 4;
|
||||
Match = NULL;
|
||||
@@ -257,8 +252,8 @@ TcpLocateListenTcb (
|
||||
(Local->Port != Node->LocalEnd.Port) ||
|
||||
!TCP_PEER_MATCH (Remote, &Node->RemoteEnd, Version) ||
|
||||
!TCP_PEER_MATCH (Local, &Node->LocalEnd, Version)
|
||||
) {
|
||||
|
||||
)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -311,9 +306,9 @@ TcpFindTcbByPeer (
|
||||
IN UINT8 Version
|
||||
)
|
||||
{
|
||||
TCP_PORTNO LocalPort;
|
||||
LIST_ENTRY *Entry;
|
||||
TCP_CB *Tcb;
|
||||
TCP_PORTNO LocalPort;
|
||||
LIST_ENTRY *Entry;
|
||||
TCP_CB *Tcb;
|
||||
|
||||
ASSERT ((Addr != NULL) && (Port != 0));
|
||||
|
||||
@@ -323,10 +318,10 @@ TcpFindTcbByPeer (
|
||||
Tcb = NET_LIST_USER_STRUCT (Entry, TCP_CB, List);
|
||||
|
||||
if ((Version == Tcb->Sk->IpVersion) &&
|
||||
TcpIsIpEqual (Addr, &Tcb->LocalEnd.Ip, Version) &&
|
||||
TcpIsIpEqual (Addr, &Tcb->LocalEnd.Ip, Version) &&
|
||||
(LocalPort == Tcb->LocalEnd.Port)
|
||||
) {
|
||||
|
||||
)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -335,10 +330,10 @@ TcpFindTcbByPeer (
|
||||
Tcb = NET_LIST_USER_STRUCT (Entry, TCP_CB, List);
|
||||
|
||||
if ((Version == Tcb->Sk->IpVersion) &&
|
||||
TcpIsIpEqual (Addr, &Tcb->LocalEnd.Ip, Version) &&
|
||||
TcpIsIpEqual (Addr, &Tcb->LocalEnd.Ip, Version) &&
|
||||
(LocalPort == Tcb->LocalEnd.Port)
|
||||
) {
|
||||
|
||||
)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -370,10 +365,10 @@ TcpLocateTcb (
|
||||
IN BOOLEAN Syn
|
||||
)
|
||||
{
|
||||
TCP_PEER Local;
|
||||
TCP_PEER Remote;
|
||||
LIST_ENTRY *Entry;
|
||||
TCP_CB *Tcb;
|
||||
TCP_PEER Local;
|
||||
TCP_PEER Remote;
|
||||
LIST_ENTRY *Entry;
|
||||
TCP_CB *Tcb;
|
||||
|
||||
Local.Port = LocalPort;
|
||||
Remote.Port = RemotePort;
|
||||
@@ -390,8 +385,8 @@ TcpLocateTcb (
|
||||
if ((Version == Tcb->Sk->IpVersion) &&
|
||||
TCP_PEER_EQUAL (&Remote, &Tcb->RemoteEnd, Version) &&
|
||||
TCP_PEER_EQUAL (&Local, &Tcb->LocalEnd, Version)
|
||||
) {
|
||||
|
||||
)
|
||||
{
|
||||
RemoveEntryList (&Tcb->List);
|
||||
InsertHeadList (&mTcpRunQue, &Tcb->List);
|
||||
|
||||
@@ -420,20 +415,20 @@ TcpLocateTcb (
|
||||
**/
|
||||
INTN
|
||||
TcpInsertTcb (
|
||||
IN TCP_CB *Tcb
|
||||
IN TCP_CB *Tcb
|
||||
)
|
||||
{
|
||||
LIST_ENTRY *Entry;
|
||||
LIST_ENTRY *Head;
|
||||
TCP_CB *Node;
|
||||
LIST_ENTRY *Entry;
|
||||
LIST_ENTRY *Head;
|
||||
TCP_CB *Node;
|
||||
|
||||
ASSERT (
|
||||
(Tcb != NULL) &&
|
||||
(
|
||||
(Tcb->State == TCP_LISTEN) ||
|
||||
(Tcb->State == TCP_SYN_SENT) ||
|
||||
(Tcb->State == TCP_SYN_RCVD) ||
|
||||
(Tcb->State == TCP_CLOSED)
|
||||
(Tcb->State == TCP_LISTEN) ||
|
||||
(Tcb->State == TCP_SYN_SENT) ||
|
||||
(Tcb->State == TCP_SYN_RCVD) ||
|
||||
(Tcb->State == TCP_CLOSED)
|
||||
)
|
||||
);
|
||||
|
||||
@@ -455,15 +450,14 @@ TcpInsertTcb (
|
||||
|
||||
if (TCP_PEER_EQUAL (&Tcb->LocalEnd, &Node->LocalEnd, Tcb->Sk->IpVersion) &&
|
||||
TCP_PEER_EQUAL (&Tcb->RemoteEnd, &Node->RemoteEnd, Tcb->Sk->IpVersion)
|
||||
) {
|
||||
|
||||
)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
InsertHeadList (Head, &Tcb->List);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -477,10 +471,10 @@ TcpInsertTcb (
|
||||
**/
|
||||
TCP_CB *
|
||||
TcpCloneTcb (
|
||||
IN TCP_CB *Tcb
|
||||
IN TCP_CB *Tcb
|
||||
)
|
||||
{
|
||||
TCP_CB *Clone;
|
||||
TCP_CB *Clone;
|
||||
|
||||
Clone = AllocateZeroPool (sizeof (TCP_CB));
|
||||
|
||||
@@ -506,7 +500,7 @@ TcpCloneTcb (
|
||||
return NULL;
|
||||
}
|
||||
|
||||
((TCP_PROTO_DATA *) (Clone->Sk->ProtoReserved))->TcpPcb = Clone;
|
||||
((TCP_PROTO_DATA *)(Clone->Sk->ProtoReserved))->TcpPcb = Clone;
|
||||
|
||||
return Clone;
|
||||
}
|
||||
@@ -539,25 +533,25 @@ TcpGetRcvMss (
|
||||
IN SOCKET *Sock
|
||||
)
|
||||
{
|
||||
EFI_IP4_MODE_DATA Ip4Mode;
|
||||
EFI_IP6_MODE_DATA Ip6Mode;
|
||||
EFI_IP4_PROTOCOL *Ip4;
|
||||
EFI_IP6_PROTOCOL *Ip6;
|
||||
TCP_PROTO_DATA *TcpProto;
|
||||
EFI_IP4_MODE_DATA Ip4Mode;
|
||||
EFI_IP6_MODE_DATA Ip6Mode;
|
||||
EFI_IP4_PROTOCOL *Ip4;
|
||||
EFI_IP6_PROTOCOL *Ip6;
|
||||
TCP_PROTO_DATA *TcpProto;
|
||||
|
||||
ASSERT (Sock != NULL);
|
||||
|
||||
ZeroMem (&Ip4Mode, sizeof (EFI_IP4_MODE_DATA));
|
||||
ZeroMem (&Ip6Mode, sizeof (EFI_IP6_MODE_DATA));
|
||||
|
||||
TcpProto = (TCP_PROTO_DATA *) Sock->ProtoReserved;
|
||||
TcpProto = (TCP_PROTO_DATA *)Sock->ProtoReserved;
|
||||
|
||||
if (Sock->IpVersion == IP_VERSION_4) {
|
||||
Ip4 = TcpProto->TcpService->IpIo->Ip.Ip4;
|
||||
ASSERT (Ip4 != NULL);
|
||||
Ip4->GetModeData (Ip4, &Ip4Mode, NULL, NULL);
|
||||
|
||||
return (UINT16) (Ip4Mode.MaxPacketSize - sizeof (TCP_HEAD));
|
||||
return (UINT16)(Ip4Mode.MaxPacketSize - sizeof (TCP_HEAD));
|
||||
} else {
|
||||
Ip6 = TcpProto->TcpService->IpIo->Ip.Ip6;
|
||||
ASSERT (Ip6 != NULL);
|
||||
@@ -587,7 +581,7 @@ TcpGetRcvMss (
|
||||
}
|
||||
}
|
||||
|
||||
return (UINT16) (Ip6Mode.MaxPacketSize - sizeof (TCP_HEAD));
|
||||
return (UINT16)(Ip6Mode.MaxPacketSize - sizeof (TCP_HEAD));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -600,8 +594,8 @@ TcpGetRcvMss (
|
||||
**/
|
||||
VOID
|
||||
TcpSetState (
|
||||
IN TCP_CB *Tcb,
|
||||
IN UINT8 State
|
||||
IN TCP_CB *Tcb,
|
||||
IN UINT8 State
|
||||
)
|
||||
{
|
||||
ASSERT (Tcb->State < (sizeof (mTcpStateName) / sizeof (CHAR16 *)));
|
||||
@@ -609,36 +603,36 @@ TcpSetState (
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"Tcb (%p) state %s --> %s\n",
|
||||
Tcb,
|
||||
mTcpStateName[Tcb->State],
|
||||
mTcpStateName[State])
|
||||
"Tcb (%p) state %s --> %s\n",
|
||||
Tcb,
|
||||
mTcpStateName[Tcb->State],
|
||||
mTcpStateName[State])
|
||||
);
|
||||
|
||||
Tcb->State = State;
|
||||
|
||||
switch (State) {
|
||||
case TCP_ESTABLISHED:
|
||||
case TCP_ESTABLISHED:
|
||||
|
||||
SockConnEstablished (Tcb->Sk);
|
||||
SockConnEstablished (Tcb->Sk);
|
||||
|
||||
if (Tcb->Parent != NULL) {
|
||||
//
|
||||
// A new connection is accepted by a listening socket. Install
|
||||
// the device path.
|
||||
//
|
||||
TcpInstallDevicePath (Tcb->Sk);
|
||||
}
|
||||
if (Tcb->Parent != NULL) {
|
||||
//
|
||||
// A new connection is accepted by a listening socket. Install
|
||||
// the device path.
|
||||
//
|
||||
TcpInstallDevicePath (Tcb->Sk);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case TCP_CLOSED:
|
||||
case TCP_CLOSED:
|
||||
|
||||
SockConnClosed (Tcb->Sk);
|
||||
SockConnClosed (Tcb->Sk);
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -653,21 +647,21 @@ TcpSetState (
|
||||
**/
|
||||
UINT16
|
||||
TcpChecksum (
|
||||
IN NET_BUF *Nbuf,
|
||||
IN UINT16 HeadSum
|
||||
IN NET_BUF *Nbuf,
|
||||
IN UINT16 HeadSum
|
||||
)
|
||||
{
|
||||
UINT16 Checksum;
|
||||
|
||||
Checksum = NetbufChecksum (Nbuf);
|
||||
Checksum = NetAddChecksum (Checksum, HeadSum);
|
||||
Checksum = NetbufChecksum (Nbuf);
|
||||
Checksum = NetAddChecksum (Checksum, HeadSum);
|
||||
|
||||
Checksum = NetAddChecksum (
|
||||
Checksum,
|
||||
HTONS ((UINT16) Nbuf->TotalSize)
|
||||
);
|
||||
Checksum,
|
||||
HTONS ((UINT16)Nbuf->TotalSize)
|
||||
);
|
||||
|
||||
return (UINT16) (~Checksum);
|
||||
return (UINT16)(~Checksum);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -682,22 +676,22 @@ TcpChecksum (
|
||||
**/
|
||||
TCP_SEG *
|
||||
TcpFormatNetbuf (
|
||||
IN TCP_CB *Tcb,
|
||||
IN OUT NET_BUF *Nbuf
|
||||
IN TCP_CB *Tcb,
|
||||
IN OUT NET_BUF *Nbuf
|
||||
)
|
||||
{
|
||||
TCP_SEG *Seg;
|
||||
TCP_HEAD *Head;
|
||||
|
||||
Seg = TCPSEG_NETBUF (Nbuf);
|
||||
Head = (TCP_HEAD *) NetbufGetByte (Nbuf, 0, NULL);
|
||||
Seg = TCPSEG_NETBUF (Nbuf);
|
||||
Head = (TCP_HEAD *)NetbufGetByte (Nbuf, 0, NULL);
|
||||
ASSERT (Head != NULL);
|
||||
|
||||
Nbuf->Tcp = Head;
|
||||
|
||||
Seg->Seq = NTOHL (Head->Seq);
|
||||
Seg->Ack = NTOHL (Head->Ack);
|
||||
Seg->End = Seg->Seq + (Nbuf->TotalSize - (Head->HeadLen << 2));
|
||||
Seg->Seq = NTOHL (Head->Seq);
|
||||
Seg->Ack = NTOHL (Head->Ack);
|
||||
Seg->End = Seg->Seq + (Nbuf->TotalSize - (Head->HeadLen << 2));
|
||||
|
||||
Seg->Urg = NTOHS (Head->Urg);
|
||||
Seg->Wnd = (NTOHS (Head->Wnd) << Tcb->SndWndScale);
|
||||
@@ -749,17 +743,16 @@ TcpOnAppConnect (
|
||||
**/
|
||||
VOID
|
||||
TcpOnAppClose (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
)
|
||||
{
|
||||
ASSERT (Tcb != NULL);
|
||||
|
||||
if (!IsListEmpty (&Tcb->RcvQue) || GET_RCV_DATASIZE (Tcb->Sk) != 0) {
|
||||
|
||||
if (!IsListEmpty (&Tcb->RcvQue) || (GET_RCV_DATASIZE (Tcb->Sk) != 0)) {
|
||||
DEBUG (
|
||||
(DEBUG_WARN,
|
||||
"TcpOnAppClose: connection reset because data is lost for TCB %p\n",
|
||||
Tcb)
|
||||
"TcpOnAppClose: connection reset because data is lost for TCB %p\n",
|
||||
Tcb)
|
||||
);
|
||||
|
||||
TcpResetConnection (Tcb);
|
||||
@@ -768,22 +761,22 @@ TcpOnAppClose (
|
||||
}
|
||||
|
||||
switch (Tcb->State) {
|
||||
case TCP_CLOSED:
|
||||
case TCP_LISTEN:
|
||||
case TCP_SYN_SENT:
|
||||
TcpSetState (Tcb, TCP_CLOSED);
|
||||
break;
|
||||
case TCP_CLOSED:
|
||||
case TCP_LISTEN:
|
||||
case TCP_SYN_SENT:
|
||||
TcpSetState (Tcb, TCP_CLOSED);
|
||||
break;
|
||||
|
||||
case TCP_SYN_RCVD:
|
||||
case TCP_ESTABLISHED:
|
||||
TcpSetState (Tcb, TCP_FIN_WAIT_1);
|
||||
break;
|
||||
case TCP_SYN_RCVD:
|
||||
case TCP_ESTABLISHED:
|
||||
TcpSetState (Tcb, TCP_FIN_WAIT_1);
|
||||
break;
|
||||
|
||||
case TCP_CLOSE_WAIT:
|
||||
TcpSetState (Tcb, TCP_LAST_ACK);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case TCP_CLOSE_WAIT:
|
||||
TcpSetState (Tcb, TCP_LAST_ACK);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
TcpToSendData (Tcb, 1);
|
||||
@@ -801,35 +794,34 @@ TcpOnAppClose (
|
||||
**/
|
||||
INTN
|
||||
TcpOnAppSend (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
)
|
||||
{
|
||||
|
||||
switch (Tcb->State) {
|
||||
case TCP_CLOSED:
|
||||
return -1;
|
||||
case TCP_CLOSED:
|
||||
return -1;
|
||||
|
||||
case TCP_LISTEN:
|
||||
return -1;
|
||||
case TCP_LISTEN:
|
||||
return -1;
|
||||
|
||||
case TCP_SYN_SENT:
|
||||
case TCP_SYN_RCVD:
|
||||
return 0;
|
||||
case TCP_SYN_SENT:
|
||||
case TCP_SYN_RCVD:
|
||||
return 0;
|
||||
|
||||
case TCP_ESTABLISHED:
|
||||
case TCP_CLOSE_WAIT:
|
||||
TcpToSendData (Tcb, 0);
|
||||
return 0;
|
||||
case TCP_ESTABLISHED:
|
||||
case TCP_CLOSE_WAIT:
|
||||
TcpToSendData (Tcb, 0);
|
||||
return 0;
|
||||
|
||||
case TCP_FIN_WAIT_1:
|
||||
case TCP_FIN_WAIT_2:
|
||||
case TCP_CLOSING:
|
||||
case TCP_LAST_ACK:
|
||||
case TCP_TIME_WAIT:
|
||||
return -1;
|
||||
case TCP_FIN_WAIT_1:
|
||||
case TCP_FIN_WAIT_2:
|
||||
case TCP_CLOSING:
|
||||
case TCP_LAST_ACK:
|
||||
case TCP_TIME_WAIT:
|
||||
return -1;
|
||||
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -844,41 +836,38 @@ TcpOnAppSend (
|
||||
**/
|
||||
VOID
|
||||
TcpOnAppConsume (
|
||||
IN TCP_CB *Tcb
|
||||
IN TCP_CB *Tcb
|
||||
)
|
||||
{
|
||||
UINT32 TcpOld;
|
||||
UINT32 TcpOld;
|
||||
|
||||
switch (Tcb->State) {
|
||||
case TCP_ESTABLISHED:
|
||||
TcpOld = TcpRcvWinOld (Tcb);
|
||||
if (TcpRcvWinNow (Tcb) > TcpOld) {
|
||||
case TCP_ESTABLISHED:
|
||||
TcpOld = TcpRcvWinOld (Tcb);
|
||||
if (TcpRcvWinNow (Tcb) > TcpOld) {
|
||||
if (TcpOld < Tcb->RcvMss) {
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"TcpOnAppConsume: send a window update for a window closed Tcb %p\n",
|
||||
Tcb)
|
||||
);
|
||||
|
||||
if (TcpOld < Tcb->RcvMss) {
|
||||
TcpSendAck (Tcb);
|
||||
} else if (Tcb->DelayedAck == 0) {
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"TcpOnAppConsume: scheduled a delayed ACK to update window for Tcb %p\n",
|
||||
Tcb)
|
||||
);
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"TcpOnAppConsume: send a window update for a window closed Tcb %p\n",
|
||||
Tcb)
|
||||
);
|
||||
|
||||
TcpSendAck (Tcb);
|
||||
} else if (Tcb->DelayedAck == 0) {
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"TcpOnAppConsume: scheduled a delayed ACK to update window for Tcb %p\n",
|
||||
Tcb)
|
||||
);
|
||||
|
||||
Tcb->DelayedAck = 1;
|
||||
Tcb->DelayedAck = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -891,25 +880,25 @@ TcpOnAppConsume (
|
||||
**/
|
||||
VOID
|
||||
TcpOnAppAbort (
|
||||
IN TCP_CB *Tcb
|
||||
IN TCP_CB *Tcb
|
||||
)
|
||||
{
|
||||
DEBUG (
|
||||
(DEBUG_WARN,
|
||||
"TcpOnAppAbort: connection reset issued by application for TCB %p\n",
|
||||
Tcb)
|
||||
"TcpOnAppAbort: connection reset issued by application for TCB %p\n",
|
||||
Tcb)
|
||||
);
|
||||
|
||||
switch (Tcb->State) {
|
||||
case TCP_SYN_RCVD:
|
||||
case TCP_ESTABLISHED:
|
||||
case TCP_FIN_WAIT_1:
|
||||
case TCP_FIN_WAIT_2:
|
||||
case TCP_CLOSE_WAIT:
|
||||
TcpResetConnection (Tcb);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case TCP_SYN_RCVD:
|
||||
case TCP_ESTABLISHED:
|
||||
case TCP_FIN_WAIT_1:
|
||||
case TCP_FIN_WAIT_2:
|
||||
case TCP_CLOSE_WAIT:
|
||||
TcpResetConnection (Tcb);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
TcpSetState (Tcb, TCP_CLOSED);
|
||||
@@ -923,7 +912,7 @@ TcpOnAppAbort (
|
||||
**/
|
||||
VOID
|
||||
TcpResetConnection (
|
||||
IN TCP_CB *Tcb
|
||||
IN TCP_CB *Tcb
|
||||
)
|
||||
{
|
||||
NET_BUF *Nbuf;
|
||||
@@ -932,10 +921,10 @@ TcpResetConnection (
|
||||
Nbuf = NetbufAlloc (TCP_MAX_HEAD);
|
||||
|
||||
if (Nbuf == NULL) {
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
Nhead = (TCP_HEAD *) NetbufAllocSpace (
|
||||
Nhead = (TCP_HEAD *)NetbufAllocSpace (
|
||||
Nbuf,
|
||||
sizeof (TCP_HEAD),
|
||||
NET_BUF_TAIL
|
||||
@@ -943,14 +932,14 @@ TcpResetConnection (
|
||||
|
||||
ASSERT (Nhead != NULL);
|
||||
|
||||
Nbuf->Tcp = Nhead;
|
||||
Nbuf->Tcp = Nhead;
|
||||
|
||||
Nhead->Flag = TCP_FLG_RST;
|
||||
Nhead->Seq = HTONL (Tcb->SndNxt);
|
||||
Nhead->Ack = HTONL (Tcb->RcvNxt);
|
||||
Nhead->SrcPort = Tcb->LocalEnd.Port;
|
||||
Nhead->DstPort = Tcb->RemoteEnd.Port;
|
||||
Nhead->HeadLen = (UINT8) (sizeof (TCP_HEAD) >> 2);
|
||||
Nhead->HeadLen = (UINT8)(sizeof (TCP_HEAD) >> 2);
|
||||
Nhead->Res = 0;
|
||||
Nhead->Wnd = HTONS (0xFFFF);
|
||||
Nhead->Checksum = 0;
|
||||
@@ -973,24 +962,24 @@ TcpResetConnection (
|
||||
**/
|
||||
EFI_STATUS
|
||||
TcpInstallDevicePath (
|
||||
IN SOCKET *Sock
|
||||
IN SOCKET *Sock
|
||||
)
|
||||
{
|
||||
TCP_PROTO_DATA *TcpProto;
|
||||
TCP_SERVICE_DATA *TcpService;
|
||||
TCP_CB *Tcb;
|
||||
IPv4_DEVICE_PATH Ip4DPathNode;
|
||||
IPv6_DEVICE_PATH Ip6DPathNode;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
EFI_STATUS Status;
|
||||
TCP_PORTNO LocalPort;
|
||||
TCP_PORTNO RemotePort;
|
||||
TCP_PROTO_DATA *TcpProto;
|
||||
TCP_SERVICE_DATA *TcpService;
|
||||
TCP_CB *Tcb;
|
||||
IPv4_DEVICE_PATH Ip4DPathNode;
|
||||
IPv6_DEVICE_PATH Ip6DPathNode;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
EFI_STATUS Status;
|
||||
TCP_PORTNO LocalPort;
|
||||
TCP_PORTNO RemotePort;
|
||||
|
||||
TcpProto = (TCP_PROTO_DATA *) Sock->ProtoReserved;
|
||||
TcpProto = (TCP_PROTO_DATA *)Sock->ProtoReserved;
|
||||
TcpService = TcpProto->TcpService;
|
||||
Tcb = TcpProto->TcpPcb;
|
||||
|
||||
LocalPort = NTOHS (Tcb->LocalEnd.Port);
|
||||
LocalPort = NTOHS (Tcb->LocalEnd.Port);
|
||||
RemotePort = NTOHS (Tcb->RemoteEnd.Port);
|
||||
if (Sock->IpVersion == IP_VERSION_4) {
|
||||
NetLibCreateIPv4DPathNode (
|
||||
@@ -1006,7 +995,7 @@ TcpInstallDevicePath (
|
||||
|
||||
IP4_COPY_ADDRESS (&Ip4DPathNode.SubnetMask, &Tcb->SubnetMask);
|
||||
|
||||
DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) &Ip4DPathNode;
|
||||
DevicePath = (EFI_DEVICE_PATH_PROTOCOL *)&Ip4DPathNode;
|
||||
} else {
|
||||
NetLibCreateIPv6DPathNode (
|
||||
&Ip6DPathNode,
|
||||
@@ -1018,7 +1007,7 @@ TcpInstallDevicePath (
|
||||
EFI_IP_PROTO_TCP
|
||||
);
|
||||
|
||||
DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) &Ip6DPathNode;
|
||||
DevicePath = (EFI_DEVICE_PATH_PROTOCOL *)&Ip6DPathNode;
|
||||
}
|
||||
|
||||
Sock->DevicePath = AppendDevicePathNode (Sock->ParentDevicePath, DevicePath);
|
||||
|
@@ -19,10 +19,11 @@
|
||||
**/
|
||||
UINT16
|
||||
TcpGetUint16 (
|
||||
IN UINT8 *Buf
|
||||
IN UINT8 *Buf
|
||||
)
|
||||
{
|
||||
UINT16 Value;
|
||||
|
||||
CopyMem (&Value, Buf, sizeof (UINT16));
|
||||
return NTOHS (Value);
|
||||
}
|
||||
@@ -37,10 +38,11 @@ TcpGetUint16 (
|
||||
**/
|
||||
UINT32
|
||||
TcpGetUint32 (
|
||||
IN UINT8 *Buf
|
||||
IN UINT8 *Buf
|
||||
)
|
||||
{
|
||||
UINT32 Value;
|
||||
|
||||
CopyMem (&Value, Buf, sizeof (UINT32));
|
||||
return NTOHL (Value);
|
||||
}
|
||||
@@ -54,8 +56,8 @@ TcpGetUint32 (
|
||||
**/
|
||||
VOID
|
||||
TcpPutUint32 (
|
||||
OUT UINT8 *Buf,
|
||||
IN UINT32 Data
|
||||
OUT UINT8 *Buf,
|
||||
IN UINT32 Data
|
||||
)
|
||||
{
|
||||
Data = HTONL (Data);
|
||||
@@ -72,7 +74,7 @@ TcpPutUint32 (
|
||||
**/
|
||||
UINT8
|
||||
TcpComputeScale (
|
||||
IN TCP_CB *Tcb
|
||||
IN TCP_CB *Tcb
|
||||
)
|
||||
{
|
||||
UINT8 Scale;
|
||||
@@ -82,9 +84,8 @@ TcpComputeScale (
|
||||
|
||||
BufSize = GET_RCV_BUFFSIZE (Tcb->Sk);
|
||||
|
||||
Scale = 0;
|
||||
while ((Scale < TCP_OPTION_MAX_WS) && ((UINT32) (TCP_OPTION_MAX_WIN << Scale) < BufSize)) {
|
||||
|
||||
Scale = 0;
|
||||
while ((Scale < TCP_OPTION_MAX_WS) && ((UINT32)(TCP_OPTION_MAX_WIN << Scale) < BufSize)) {
|
||||
Scale++;
|
||||
}
|
||||
|
||||
@@ -102,8 +103,8 @@ TcpComputeScale (
|
||||
**/
|
||||
UINT16
|
||||
TcpSynBuildOption (
|
||||
IN TCP_CB *Tcb,
|
||||
IN NET_BUF *Nbuf
|
||||
IN TCP_CB *Tcb,
|
||||
IN NET_BUF *Nbuf
|
||||
)
|
||||
{
|
||||
UINT8 *Data;
|
||||
@@ -120,9 +121,9 @@ TcpSynBuildOption (
|
||||
//
|
||||
if (!TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_NO_TS) &&
|
||||
(!TCP_FLG_ON (TCPSEG_NETBUF (Nbuf)->Flag, TCP_FLG_ACK) ||
|
||||
TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_RCVD_TS))
|
||||
) {
|
||||
|
||||
TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_RCVD_TS))
|
||||
)
|
||||
{
|
||||
Data = NetbufAllocSpace (
|
||||
Nbuf,
|
||||
TCP_OPTION_TS_ALIGNED_LEN,
|
||||
@@ -144,9 +145,9 @@ TcpSynBuildOption (
|
||||
//
|
||||
if (!TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_NO_WS) &&
|
||||
(!TCP_FLG_ON (TCPSEG_NETBUF (Nbuf)->Flag, TCP_FLG_ACK) ||
|
||||
TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_RCVD_WS))
|
||||
) {
|
||||
|
||||
TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_RCVD_WS))
|
||||
)
|
||||
{
|
||||
Data = NetbufAllocSpace (
|
||||
Nbuf,
|
||||
TCP_OPTION_WS_ALIGNED_LEN,
|
||||
@@ -182,8 +183,8 @@ TcpSynBuildOption (
|
||||
**/
|
||||
UINT16
|
||||
TcpBuildOption (
|
||||
IN TCP_CB *Tcb,
|
||||
IN NET_BUF *Nbuf
|
||||
IN TCP_CB *Tcb,
|
||||
IN NET_BUF *Nbuf
|
||||
)
|
||||
{
|
||||
UINT8 *Data;
|
||||
@@ -197,13 +198,13 @@ TcpBuildOption (
|
||||
//
|
||||
if (TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_SND_TS) &&
|
||||
!TCP_FLG_ON (TCPSEG_NETBUF (Nbuf)->Flag, TCP_FLG_RST)
|
||||
) {
|
||||
|
||||
)
|
||||
{
|
||||
Data = NetbufAllocSpace (
|
||||
Nbuf,
|
||||
TCP_OPTION_TS_ALIGNED_LEN,
|
||||
NET_BUF_HEAD
|
||||
);
|
||||
Nbuf,
|
||||
TCP_OPTION_TS_ALIGNED_LEN,
|
||||
NET_BUF_HEAD
|
||||
);
|
||||
|
||||
ASSERT (Data != NULL);
|
||||
Len += TCP_OPTION_TS_ALIGNED_LEN;
|
||||
@@ -229,38 +230,38 @@ TcpBuildOption (
|
||||
**/
|
||||
INTN
|
||||
TcpParseOption (
|
||||
IN TCP_HEAD *Tcp,
|
||||
IN OUT TCP_OPTION *Option
|
||||
IN TCP_HEAD *Tcp,
|
||||
IN OUT TCP_OPTION *Option
|
||||
)
|
||||
{
|
||||
UINT8 *Head;
|
||||
UINT8 TotalLen;
|
||||
UINT8 Cur;
|
||||
UINT8 Type;
|
||||
UINT8 Len;
|
||||
UINT8 *Head;
|
||||
UINT8 TotalLen;
|
||||
UINT8 Cur;
|
||||
UINT8 Type;
|
||||
UINT8 Len;
|
||||
|
||||
ASSERT ((Tcp != NULL) && (Option != NULL));
|
||||
|
||||
Option->Flag = 0;
|
||||
Option->Flag = 0;
|
||||
|
||||
TotalLen = (UINT8) ((Tcp->HeadLen << 2) - sizeof (TCP_HEAD));
|
||||
TotalLen = (UINT8)((Tcp->HeadLen << 2) - sizeof (TCP_HEAD));
|
||||
if (TotalLen <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Head = (UINT8 *) (Tcp + 1);
|
||||
Head = (UINT8 *)(Tcp + 1);
|
||||
|
||||
//
|
||||
// Fast process of the timestamp option.
|
||||
//
|
||||
if ((TotalLen == TCP_OPTION_TS_ALIGNED_LEN) && (TcpGetUint32 (Head) == TCP_OPTION_TS_FAST)) {
|
||||
|
||||
Option->TSVal = TcpGetUint32 (Head + 4);
|
||||
Option->TSEcr = TcpGetUint32 (Head + 8);
|
||||
Option->Flag = TCP_OPTION_RCVD_TS;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Slow path to process the options.
|
||||
//
|
||||
@@ -270,68 +271,64 @@ TcpParseOption (
|
||||
Type = Head[Cur];
|
||||
|
||||
switch (Type) {
|
||||
case TCP_OPTION_MSS:
|
||||
Len = Head[Cur + 1];
|
||||
case TCP_OPTION_MSS:
|
||||
Len = Head[Cur + 1];
|
||||
|
||||
if ((Len != TCP_OPTION_MSS_LEN) || (TotalLen - Cur < TCP_OPTION_MSS_LEN)) {
|
||||
if ((Len != TCP_OPTION_MSS_LEN) || (TotalLen - Cur < TCP_OPTION_MSS_LEN)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
Option->Mss = TcpGetUint16 (&Head[Cur + 2]);
|
||||
TCP_SET_FLG (Option->Flag, TCP_OPTION_RCVD_MSS);
|
||||
|
||||
Option->Mss = TcpGetUint16 (&Head[Cur + 2]);
|
||||
TCP_SET_FLG (Option->Flag, TCP_OPTION_RCVD_MSS);
|
||||
Cur += TCP_OPTION_MSS_LEN;
|
||||
break;
|
||||
|
||||
Cur += TCP_OPTION_MSS_LEN;
|
||||
break;
|
||||
case TCP_OPTION_WS:
|
||||
Len = Head[Cur + 1];
|
||||
|
||||
case TCP_OPTION_WS:
|
||||
Len = Head[Cur + 1];
|
||||
if ((Len != TCP_OPTION_WS_LEN) || (TotalLen - Cur < TCP_OPTION_WS_LEN)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((Len != TCP_OPTION_WS_LEN) || (TotalLen - Cur < TCP_OPTION_WS_LEN)) {
|
||||
Option->WndScale = (UINT8)MIN (14, Head[Cur + 2]);
|
||||
TCP_SET_FLG (Option->Flag, TCP_OPTION_RCVD_WS);
|
||||
|
||||
return -1;
|
||||
}
|
||||
Cur += TCP_OPTION_WS_LEN;
|
||||
break;
|
||||
|
||||
Option->WndScale = (UINT8) MIN (14, Head[Cur + 2]);
|
||||
TCP_SET_FLG (Option->Flag, TCP_OPTION_RCVD_WS);
|
||||
case TCP_OPTION_TS:
|
||||
Len = Head[Cur + 1];
|
||||
|
||||
Cur += TCP_OPTION_WS_LEN;
|
||||
break;
|
||||
if ((Len != TCP_OPTION_TS_LEN) || (TotalLen - Cur < TCP_OPTION_TS_LEN)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
case TCP_OPTION_TS:
|
||||
Len = Head[Cur + 1];
|
||||
Option->TSVal = TcpGetUint32 (&Head[Cur + 2]);
|
||||
Option->TSEcr = TcpGetUint32 (&Head[Cur + 6]);
|
||||
TCP_SET_FLG (Option->Flag, TCP_OPTION_RCVD_TS);
|
||||
|
||||
if ((Len != TCP_OPTION_TS_LEN) || (TotalLen - Cur < TCP_OPTION_TS_LEN)) {
|
||||
Cur += TCP_OPTION_TS_LEN;
|
||||
break;
|
||||
|
||||
return -1;
|
||||
}
|
||||
case TCP_OPTION_NOP:
|
||||
Cur++;
|
||||
break;
|
||||
|
||||
Option->TSVal = TcpGetUint32 (&Head[Cur + 2]);
|
||||
Option->TSEcr = TcpGetUint32 (&Head[Cur + 6]);
|
||||
TCP_SET_FLG (Option->Flag, TCP_OPTION_RCVD_TS);
|
||||
case TCP_OPTION_EOP:
|
||||
Cur = TotalLen;
|
||||
break;
|
||||
|
||||
Cur += TCP_OPTION_TS_LEN;
|
||||
break;
|
||||
default:
|
||||
Len = Head[Cur + 1];
|
||||
|
||||
case TCP_OPTION_NOP:
|
||||
Cur++;
|
||||
break;
|
||||
if (((TotalLen - Cur) < Len) || (Len < 2)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
case TCP_OPTION_EOP:
|
||||
Cur = TotalLen;
|
||||
break;
|
||||
|
||||
default:
|
||||
Len = Head[Cur + 1];
|
||||
|
||||
if ((TotalLen - Cur) < Len || Len < 2) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
Cur = (UINT8) (Cur + Len);
|
||||
break;
|
||||
Cur = (UINT8)(Cur + Len);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@@ -28,12 +28,12 @@
|
||||
// recommend format of timestamp window scale
|
||||
// option for fast process.
|
||||
//
|
||||
#define TCP_OPTION_TS_FAST ((TCP_OPTION_NOP << 24) | \
|
||||
#define TCP_OPTION_TS_FAST ((TCP_OPTION_NOP << 24) |\
|
||||
(TCP_OPTION_NOP << 16) | \
|
||||
(TCP_OPTION_TS << 8) | \
|
||||
(TCP_OPTION_TS_LEN))
|
||||
|
||||
#define TCP_OPTION_WS_FAST ((TCP_OPTION_NOP << 24) | \
|
||||
#define TCP_OPTION_WS_FAST ((TCP_OPTION_NOP << 24) | \
|
||||
(TCP_OPTION_WS << 16) | \
|
||||
(TCP_OPTION_WS_LEN << 8))
|
||||
|
||||
@@ -42,22 +42,22 @@
|
||||
//
|
||||
// Other misc definitions
|
||||
//
|
||||
#define TCP_OPTION_RCVD_MSS 0x01
|
||||
#define TCP_OPTION_RCVD_WS 0x02
|
||||
#define TCP_OPTION_RCVD_TS 0x04
|
||||
#define TCP_OPTION_MAX_WS 14 ///< Maximum window scale value
|
||||
#define TCP_OPTION_MAX_WIN 0xffff ///< Max window size in TCP header
|
||||
#define TCP_OPTION_RCVD_MSS 0x01
|
||||
#define TCP_OPTION_RCVD_WS 0x02
|
||||
#define TCP_OPTION_RCVD_TS 0x04
|
||||
#define TCP_OPTION_MAX_WS 14 ///< Maximum window scale value
|
||||
#define TCP_OPTION_MAX_WIN 0xffff ///< Max window size in TCP header
|
||||
|
||||
///
|
||||
/// The structure to store the parse option value.
|
||||
/// ParseOption only parses the options, doesn't process them.
|
||||
///
|
||||
typedef struct _TCP_OPTION {
|
||||
UINT8 Flag; ///< Flag such as TCP_OPTION_RCVD_MSS
|
||||
UINT8 WndScale; ///< The WndScale received
|
||||
UINT16 Mss; ///< The Mss received
|
||||
UINT32 TSVal; ///< The TSVal field in a timestamp option
|
||||
UINT32 TSEcr; ///< The TSEcr field in a timestamp option
|
||||
UINT8 Flag; ///< Flag such as TCP_OPTION_RCVD_MSS
|
||||
UINT8 WndScale; ///< The WndScale received
|
||||
UINT16 Mss; ///< The Mss received
|
||||
UINT32 TSVal; ///< The TSVal field in a timestamp option
|
||||
UINT32 TSEcr; ///< The TSEcr field in a timestamp option
|
||||
} TCP_OPTION;
|
||||
|
||||
/**
|
||||
@@ -70,7 +70,7 @@ typedef struct _TCP_OPTION {
|
||||
**/
|
||||
UINT8
|
||||
TcpComputeScale (
|
||||
IN TCP_CB *Tcb
|
||||
IN TCP_CB *Tcb
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -84,8 +84,8 @@ TcpComputeScale (
|
||||
**/
|
||||
UINT16
|
||||
TcpSynBuildOption (
|
||||
IN TCP_CB *Tcb,
|
||||
IN NET_BUF *Nbuf
|
||||
IN TCP_CB *Tcb,
|
||||
IN NET_BUF *Nbuf
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -99,8 +99,8 @@ TcpSynBuildOption (
|
||||
**/
|
||||
UINT16
|
||||
TcpBuildOption (
|
||||
IN TCP_CB *Tcb,
|
||||
IN NET_BUF *Nbuf
|
||||
IN TCP_CB *Tcb,
|
||||
IN NET_BUF *Nbuf
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -116,8 +116,8 @@ TcpBuildOption (
|
||||
**/
|
||||
INTN
|
||||
TcpParseOption (
|
||||
IN TCP_HEAD *Tcp,
|
||||
IN OUT TCP_OPTION *Option
|
||||
IN TCP_HEAD *Tcp,
|
||||
IN OUT TCP_OPTION *Option
|
||||
);
|
||||
|
||||
#endif
|
||||
|
@@ -33,7 +33,7 @@ UINT8 mTcpOutFlag[] = {
|
||||
**/
|
||||
UINT32
|
||||
TcpRcvWinOld (
|
||||
IN TCP_CB *Tcb
|
||||
IN TCP_CB *Tcb
|
||||
)
|
||||
{
|
||||
UINT32 OldWin;
|
||||
@@ -41,11 +41,10 @@ TcpRcvWinOld (
|
||||
OldWin = 0;
|
||||
|
||||
if (TCP_SEQ_GT (Tcb->RcvWl2 + Tcb->RcvWnd, Tcb->RcvNxt)) {
|
||||
|
||||
OldWin = TCP_SUB_SEQ (
|
||||
Tcb->RcvWl2 + Tcb->RcvWnd,
|
||||
Tcb->RcvNxt
|
||||
);
|
||||
Tcb->RcvWl2 + Tcb->RcvWnd,
|
||||
Tcb->RcvNxt
|
||||
);
|
||||
}
|
||||
|
||||
return OldWin;
|
||||
@@ -61,7 +60,7 @@ TcpRcvWinOld (
|
||||
**/
|
||||
UINT32
|
||||
TcpRcvWinNow (
|
||||
IN TCP_CB *Tcb
|
||||
IN TCP_CB *Tcb
|
||||
)
|
||||
{
|
||||
SOCKET *Sk;
|
||||
@@ -72,11 +71,11 @@ TcpRcvWinNow (
|
||||
Sk = Tcb->Sk;
|
||||
ASSERT (Sk != NULL);
|
||||
|
||||
OldWin = TcpRcvWinOld (Tcb);
|
||||
OldWin = TcpRcvWinOld (Tcb);
|
||||
|
||||
Win = SockGetFreeSpace (Sk, SOCK_RCV_BUF);
|
||||
Win = SockGetFreeSpace (Sk, SOCK_RCV_BUF);
|
||||
|
||||
Increase = 0;
|
||||
Increase = 0;
|
||||
if (Win > OldWin) {
|
||||
Increase = Win - OldWin;
|
||||
}
|
||||
@@ -87,7 +86,6 @@ TcpRcvWinNow (
|
||||
// half of the receive buffer.
|
||||
//
|
||||
if ((Increase > Tcb->SndMss) || (2 * Increase >= GET_RCV_BUFFSIZE (Sk))) {
|
||||
|
||||
return Win;
|
||||
}
|
||||
|
||||
@@ -106,8 +104,8 @@ TcpRcvWinNow (
|
||||
**/
|
||||
UINT16
|
||||
TcpComputeWnd (
|
||||
IN OUT TCP_CB *Tcb,
|
||||
IN BOOLEAN Syn
|
||||
IN OUT TCP_CB *Tcb,
|
||||
IN BOOLEAN Syn
|
||||
)
|
||||
{
|
||||
UINT32 Wnd;
|
||||
@@ -116,17 +114,15 @@ TcpComputeWnd (
|
||||
// RFC requires that initial window not be scaled
|
||||
//
|
||||
if (Syn) {
|
||||
|
||||
Wnd = GET_RCV_BUFFSIZE (Tcb->Sk);
|
||||
} else {
|
||||
|
||||
Wnd = TcpRcvWinNow (Tcb);
|
||||
Wnd = TcpRcvWinNow (Tcb);
|
||||
|
||||
Tcb->RcvWnd = Wnd;
|
||||
}
|
||||
|
||||
Wnd = MIN (Wnd >> Tcb->RcvWndScale, 0xffff);
|
||||
return NTOHS ((UINT16) Wnd);
|
||||
return NTOHS ((UINT16)Wnd);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -139,11 +135,11 @@ TcpComputeWnd (
|
||||
**/
|
||||
TCP_SEQNO
|
||||
TcpGetMaxSndNxt (
|
||||
IN TCP_CB *Tcb
|
||||
IN TCP_CB *Tcb
|
||||
)
|
||||
{
|
||||
LIST_ENTRY *Entry;
|
||||
NET_BUF *Nbuf;
|
||||
LIST_ENTRY *Entry;
|
||||
NET_BUF *Nbuf;
|
||||
|
||||
if (IsListEmpty (&Tcb->SndQue)) {
|
||||
return Tcb->SndNxt;
|
||||
@@ -168,8 +164,8 @@ TcpGetMaxSndNxt (
|
||||
**/
|
||||
UINT32
|
||||
TcpDataToSend (
|
||||
IN TCP_CB *Tcb,
|
||||
IN INTN Force
|
||||
IN TCP_CB *Tcb,
|
||||
IN INTN Force
|
||||
)
|
||||
{
|
||||
SOCKET *Sk;
|
||||
@@ -192,7 +188,6 @@ TcpDataToSend (
|
||||
Limit = Tcb->SndWl2 + Tcb->SndWnd;
|
||||
|
||||
if (TCP_SEQ_GT (Limit, Tcb->SndUna + Tcb->CWnd)) {
|
||||
|
||||
Limit = Tcb->SndUna + Tcb->CWnd;
|
||||
}
|
||||
|
||||
@@ -206,19 +201,19 @@ TcpDataToSend (
|
||||
// buffer. The later can be non-zero if the peer shrinks
|
||||
// its advertised window.
|
||||
//
|
||||
Left = GET_SND_DATASIZE (Sk) + TCP_SUB_SEQ (TcpGetMaxSndNxt (Tcb), Tcb->SndNxt);
|
||||
Left = GET_SND_DATASIZE (Sk) + TCP_SUB_SEQ (TcpGetMaxSndNxt (Tcb), Tcb->SndNxt);
|
||||
|
||||
Len = MIN (Win, Left);
|
||||
Len = MIN (Win, Left);
|
||||
|
||||
if (Len > Tcb->SndMss) {
|
||||
Len = Tcb->SndMss;
|
||||
}
|
||||
|
||||
if ((Force != 0)|| (Len == 0 && Left == 0)) {
|
||||
if ((Force != 0) || ((Len == 0) && (Left == 0))) {
|
||||
return Len;
|
||||
}
|
||||
|
||||
if (Len == 0 && Left != 0) {
|
||||
if ((Len == 0) && (Left != 0)) {
|
||||
goto SetPersistTimer;
|
||||
}
|
||||
|
||||
@@ -231,14 +226,13 @@ TcpDataToSend (
|
||||
// expecting an ACK, or the Nagle algorithm is disabled.
|
||||
//
|
||||
if ((Len == Tcb->SndMss) || (2 * Len >= Tcb->SndWndMax)) {
|
||||
|
||||
return Len;
|
||||
}
|
||||
|
||||
if ((Len == Left) &&
|
||||
((Tcb->SndNxt == Tcb->SndUna) || TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_NO_NAGLE))
|
||||
) {
|
||||
|
||||
)
|
||||
{
|
||||
return Len;
|
||||
}
|
||||
|
||||
@@ -248,11 +242,10 @@ TcpDataToSend (
|
||||
//
|
||||
SetPersistTimer:
|
||||
if (!TCP_TIMER_ON (Tcb->EnabledTimer, TCP_TIMER_REXMIT)) {
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_WARN,
|
||||
"TcpDataToSend: enter persistent state for TCB %p\n",
|
||||
Tcb)
|
||||
"TcpDataToSend: enter persistent state for TCB %p\n",
|
||||
Tcb)
|
||||
);
|
||||
|
||||
if (!Tcb->ProbeTimerOn) {
|
||||
@@ -276,8 +269,8 @@ SetPersistTimer:
|
||||
**/
|
||||
INTN
|
||||
TcpTransmitSegment (
|
||||
IN OUT TCP_CB *Tcb,
|
||||
IN NET_BUF *Nbuf
|
||||
IN OUT TCP_CB *Tcb,
|
||||
IN NET_BUF *Nbuf
|
||||
)
|
||||
{
|
||||
UINT16 Len;
|
||||
@@ -294,14 +287,12 @@ TcpTransmitSegment (
|
||||
|
||||
DataLen = Nbuf->TotalSize;
|
||||
|
||||
Seg = TCPSEG_NETBUF (Nbuf);
|
||||
Syn = TCP_FLG_ON (Seg->Flag, TCP_FLG_SYN);
|
||||
Seg = TCPSEG_NETBUF (Nbuf);
|
||||
Syn = TCP_FLG_ON (Seg->Flag, TCP_FLG_SYN);
|
||||
|
||||
if (Syn) {
|
||||
|
||||
Len = TcpSynBuildOption (Tcb, Nbuf);
|
||||
} else {
|
||||
|
||||
Len = TcpBuildOption (Tcb, Nbuf);
|
||||
}
|
||||
|
||||
@@ -309,24 +300,24 @@ TcpTransmitSegment (
|
||||
|
||||
Len += sizeof (TCP_HEAD);
|
||||
|
||||
Head = (TCP_HEAD *) NetbufAllocSpace (
|
||||
Nbuf,
|
||||
sizeof (TCP_HEAD),
|
||||
NET_BUF_HEAD
|
||||
);
|
||||
Head = (TCP_HEAD *)NetbufAllocSpace (
|
||||
Nbuf,
|
||||
sizeof (TCP_HEAD),
|
||||
NET_BUF_HEAD
|
||||
);
|
||||
|
||||
ASSERT (Head != NULL);
|
||||
|
||||
Nbuf->Tcp = Head;
|
||||
Nbuf->Tcp = Head;
|
||||
|
||||
Head->SrcPort = Tcb->LocalEnd.Port;
|
||||
Head->DstPort = Tcb->RemoteEnd.Port;
|
||||
Head->Seq = NTOHL (Seg->Seq);
|
||||
Head->Ack = NTOHL (Tcb->RcvNxt);
|
||||
Head->HeadLen = (UINT8) (Len >> 2);
|
||||
Head->Res = 0;
|
||||
Head->Wnd = TcpComputeWnd (Tcb, Syn);
|
||||
Head->Checksum = 0;
|
||||
Head->SrcPort = Tcb->LocalEnd.Port;
|
||||
Head->DstPort = Tcb->RemoteEnd.Port;
|
||||
Head->Seq = NTOHL (Seg->Seq);
|
||||
Head->Ack = NTOHL (Tcb->RcvNxt);
|
||||
Head->HeadLen = (UINT8)(Len >> 2);
|
||||
Head->Res = 0;
|
||||
Head->Wnd = TcpComputeWnd (Tcb, Syn);
|
||||
Head->Checksum = 0;
|
||||
|
||||
//
|
||||
// Check whether to set the PSH flag.
|
||||
@@ -336,13 +327,11 @@ TcpTransmitSegment (
|
||||
if (DataLen != 0) {
|
||||
if (TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_SND_PSH) &&
|
||||
TCP_SEQ_BETWEEN (Seg->Seq, Tcb->SndPsh, Seg->End)
|
||||
) {
|
||||
|
||||
)
|
||||
{
|
||||
TCP_SET_FLG (Seg->Flag, TCP_FLG_PSH);
|
||||
TCP_CLEAR_FLG (Tcb->CtrlFlag, TCP_CTRL_SND_PSH);
|
||||
|
||||
} else if ((Seg->End == Tcb->SndNxt) && (GET_SND_DATASIZE (Tcb->Sk) == 0)) {
|
||||
|
||||
TCP_SET_FLG (Seg->Flag, TCP_FLG_PSH);
|
||||
}
|
||||
}
|
||||
@@ -353,25 +342,24 @@ TcpTransmitSegment (
|
||||
TCP_CLEAR_FLG (Seg->Flag, TCP_FLG_URG);
|
||||
|
||||
if (TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_SND_URG) && TCP_SEQ_LEQ (Seg->Seq, Tcb->SndUp)) {
|
||||
|
||||
TCP_SET_FLG (Seg->Flag, TCP_FLG_URG);
|
||||
|
||||
if (TCP_SEQ_LT (Tcb->SndUp, Seg->End)) {
|
||||
|
||||
Seg->Urg = (UINT16) TCP_SUB_SEQ (Tcb->SndUp, Seg->Seq);
|
||||
Seg->Urg = (UINT16)TCP_SUB_SEQ (Tcb->SndUp, Seg->Seq);
|
||||
} else {
|
||||
|
||||
Seg->Urg = (UINT16) MIN (
|
||||
TCP_SUB_SEQ (Tcb->SndUp,
|
||||
Seg->Seq),
|
||||
0xffff
|
||||
);
|
||||
Seg->Urg = (UINT16)MIN (
|
||||
TCP_SUB_SEQ (
|
||||
Tcb->SndUp,
|
||||
Seg->Seq
|
||||
),
|
||||
0xffff
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Head->Flag = Seg->Flag;
|
||||
Head->Urg = NTOHS (Seg->Urg);
|
||||
Head->Checksum = TcpChecksum (Nbuf, Tcb->HeadSum);
|
||||
Head->Flag = Seg->Flag;
|
||||
Head->Urg = NTOHS (Seg->Urg);
|
||||
Head->Checksum = TcpChecksum (Nbuf, Tcb->HeadSum);
|
||||
|
||||
//
|
||||
// Update the TCP session's control information.
|
||||
@@ -401,38 +389,37 @@ TcpTransmitSegment (
|
||||
**/
|
||||
NET_BUF *
|
||||
TcpGetSegmentSndQue (
|
||||
IN TCP_CB *Tcb,
|
||||
IN TCP_SEQNO Seq,
|
||||
IN UINT32 Len
|
||||
IN TCP_CB *Tcb,
|
||||
IN TCP_SEQNO Seq,
|
||||
IN UINT32 Len
|
||||
)
|
||||
{
|
||||
LIST_ENTRY *Head;
|
||||
LIST_ENTRY *Cur;
|
||||
NET_BUF *Node;
|
||||
TCP_SEG *Seg;
|
||||
NET_BUF *Nbuf;
|
||||
TCP_SEQNO End;
|
||||
UINT8 *Data;
|
||||
UINT8 Flag;
|
||||
INT32 Offset;
|
||||
INT32 CopyLen;
|
||||
LIST_ENTRY *Head;
|
||||
LIST_ENTRY *Cur;
|
||||
NET_BUF *Node;
|
||||
TCP_SEG *Seg;
|
||||
NET_BUF *Nbuf;
|
||||
TCP_SEQNO End;
|
||||
UINT8 *Data;
|
||||
UINT8 Flag;
|
||||
INT32 Offset;
|
||||
INT32 CopyLen;
|
||||
|
||||
ASSERT ((Tcb != NULL) && TCP_SEQ_LEQ (Seq, Tcb->SndNxt) && (Len > 0));
|
||||
|
||||
//
|
||||
// Find the segment that contains the Seq.
|
||||
//
|
||||
Head = &Tcb->SndQue;
|
||||
Head = &Tcb->SndQue;
|
||||
|
||||
Node = NULL;
|
||||
Seg = NULL;
|
||||
Node = NULL;
|
||||
Seg = NULL;
|
||||
|
||||
NET_LIST_FOR_EACH (Cur, Head) {
|
||||
Node = NET_LIST_USER_STRUCT (Cur, NET_BUF, List);
|
||||
Seg = TCPSEG_NETBUF (Node);
|
||||
Node = NET_LIST_USER_STRUCT (Cur, NET_BUF, List);
|
||||
Seg = TCPSEG_NETBUF (Node);
|
||||
|
||||
if (TCP_SEQ_LT (Seq, Seg->End) && TCP_SEQ_LEQ (Seg->Seq, Seq)) {
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -448,8 +435,8 @@ TcpGetSegmentSndQue (
|
||||
if ((Seg->Seq == Seq) &&
|
||||
TCP_SEQ_LEQ (Seg->End, Seg->Seq + Len) &&
|
||||
!NET_BUF_SHARED (Node)
|
||||
) {
|
||||
|
||||
)
|
||||
{
|
||||
NET_GET_REF (Node);
|
||||
return Node;
|
||||
}
|
||||
@@ -465,8 +452,8 @@ TcpGetSegmentSndQue (
|
||||
|
||||
NetbufReserve (Nbuf, TCP_MAX_HEAD);
|
||||
|
||||
Flag = Seg->Flag;
|
||||
End = Seg->End;
|
||||
Flag = Seg->Flag;
|
||||
End = Seg->End;
|
||||
|
||||
if (TCP_SEQ_LT (Seq + Len, Seg->End)) {
|
||||
End = Seq + Len;
|
||||
@@ -482,13 +469,10 @@ TcpGetSegmentSndQue (
|
||||
// one byte less.
|
||||
//
|
||||
if (TCP_FLG_ON (Seg->Flag, TCP_FLG_SYN)) {
|
||||
|
||||
if (TCP_SEQ_LT (Seg->Seq, Seq)) {
|
||||
|
||||
TCP_CLEAR_FLG (Flag, TCP_FLG_SYN);
|
||||
Offset--;
|
||||
} else {
|
||||
|
||||
CopyLen--;
|
||||
}
|
||||
}
|
||||
@@ -498,12 +482,9 @@ TcpGetSegmentSndQue (
|
||||
// and if it is out of the range, clear the flag.
|
||||
//
|
||||
if (TCP_FLG_ON (Seg->Flag, TCP_FLG_FIN)) {
|
||||
|
||||
if (Seg->End == End) {
|
||||
|
||||
CopyLen--;
|
||||
} else {
|
||||
|
||||
TCP_CLEAR_FLG (Flag, TCP_FLG_FIN);
|
||||
}
|
||||
}
|
||||
@@ -517,16 +498,16 @@ TcpGetSegmentSndQue (
|
||||
Data = NetbufAllocSpace (Nbuf, CopyLen, NET_BUF_TAIL);
|
||||
ASSERT (Data != NULL);
|
||||
|
||||
if ((INT32) NetbufCopy (Node, Offset, CopyLen, Data) != CopyLen) {
|
||||
if ((INT32)NetbufCopy (Node, Offset, CopyLen, Data) != CopyLen) {
|
||||
goto OnError;
|
||||
}
|
||||
}
|
||||
|
||||
CopyMem (TCPSEG_NETBUF (Nbuf), Seg, sizeof (TCP_SEG));
|
||||
|
||||
TCPSEG_NETBUF (Nbuf)->Seq = Seq;
|
||||
TCPSEG_NETBUF (Nbuf)->End = End;
|
||||
TCPSEG_NETBUF (Nbuf)->Flag = Flag;
|
||||
TCPSEG_NETBUF (Nbuf)->Seq = Seq;
|
||||
TCPSEG_NETBUF (Nbuf)->End = End;
|
||||
TCPSEG_NETBUF (Nbuf)->Flag = Flag;
|
||||
|
||||
return Nbuf;
|
||||
|
||||
@@ -547,14 +528,14 @@ OnError:
|
||||
**/
|
||||
NET_BUF *
|
||||
TcpGetSegmentSock (
|
||||
IN TCP_CB *Tcb,
|
||||
IN TCP_SEQNO Seq,
|
||||
IN UINT32 Len
|
||||
IN TCP_CB *Tcb,
|
||||
IN TCP_SEQNO Seq,
|
||||
IN UINT32 Len
|
||||
)
|
||||
{
|
||||
NET_BUF *Nbuf;
|
||||
UINT8 *Data;
|
||||
UINT32 DataGet;
|
||||
NET_BUF *Nbuf;
|
||||
UINT8 *Data;
|
||||
UINT32 DataGet;
|
||||
|
||||
ASSERT ((Tcb != NULL) && (Tcb->Sk != NULL));
|
||||
|
||||
@@ -563,8 +544,8 @@ TcpGetSegmentSock (
|
||||
if (Nbuf == NULL) {
|
||||
DEBUG (
|
||||
(DEBUG_ERROR,
|
||||
"TcpGetSegmentSock: failed to allocate a netbuf for TCB %p\n",
|
||||
Tcb)
|
||||
"TcpGetSegmentSock: failed to allocate a netbuf for TCB %p\n",
|
||||
Tcb)
|
||||
);
|
||||
|
||||
return NULL;
|
||||
@@ -592,7 +573,6 @@ TcpGetSegmentSock (
|
||||
InsertTailList (&(Tcb->SndQue), &(Nbuf->List));
|
||||
|
||||
if (DataGet != 0) {
|
||||
|
||||
SockDataSent (Tcb->Sk, DataGet);
|
||||
}
|
||||
|
||||
@@ -612,12 +592,12 @@ TcpGetSegmentSock (
|
||||
**/
|
||||
NET_BUF *
|
||||
TcpGetSegment (
|
||||
IN TCP_CB *Tcb,
|
||||
IN TCP_SEQNO Seq,
|
||||
IN UINT32 Len
|
||||
IN TCP_CB *Tcb,
|
||||
IN TCP_SEQNO Seq,
|
||||
IN UINT32 Len
|
||||
)
|
||||
{
|
||||
NET_BUF *Nbuf;
|
||||
NET_BUF *Nbuf;
|
||||
|
||||
ASSERT (Tcb != NULL);
|
||||
|
||||
@@ -625,10 +605,8 @@ TcpGetSegment (
|
||||
// Compare the SndNxt with the max sequence number sent.
|
||||
//
|
||||
if ((Len != 0) && TCP_SEQ_LT (Seq, TcpGetMaxSndNxt (Tcb))) {
|
||||
|
||||
Nbuf = TcpGetSegmentSndQue (Tcb, Seq, Len);
|
||||
} else {
|
||||
|
||||
Nbuf = TcpGetSegmentSock (Tcb, Seq, Len);
|
||||
}
|
||||
|
||||
@@ -652,12 +630,12 @@ TcpGetSegment (
|
||||
**/
|
||||
INTN
|
||||
TcpRetransmit (
|
||||
IN TCP_CB *Tcb,
|
||||
IN TCP_SEQNO Seq
|
||||
IN TCP_CB *Tcb,
|
||||
IN TCP_SEQNO Seq
|
||||
)
|
||||
{
|
||||
NET_BUF *Nbuf;
|
||||
UINT32 Len;
|
||||
NET_BUF *Nbuf;
|
||||
UINT32 Len;
|
||||
|
||||
//
|
||||
// Compute the maximum length of retransmission. It is
|
||||
@@ -675,22 +653,21 @@ TcpRetransmit (
|
||||
// as the original segment was in window when it was sent.
|
||||
//
|
||||
if ((Tcb->SndWndScale != 0) &&
|
||||
(TCP_SEQ_GT (Seq, Tcb->RetxmitSeqMax) || TCP_SEQ_BETWEEN (Tcb->SndWl2 + Tcb->SndWnd, Seq, Tcb->SndWl2 + Tcb->SndWnd + (1 << Tcb->SndWndScale)))) {
|
||||
(TCP_SEQ_GT (Seq, Tcb->RetxmitSeqMax) || TCP_SEQ_BETWEEN (Tcb->SndWl2 + Tcb->SndWnd, Seq, Tcb->SndWl2 + Tcb->SndWnd + (1 << Tcb->SndWndScale))))
|
||||
{
|
||||
Len = TCP_SUB_SEQ (Tcb->SndNxt, Seq);
|
||||
DEBUG (
|
||||
(DEBUG_WARN,
|
||||
"TcpRetransmit: retransmission without regard to the receiver window for TCB %p\n",
|
||||
Tcb)
|
||||
"TcpRetransmit: retransmission without regard to the receiver window for TCB %p\n",
|
||||
Tcb)
|
||||
);
|
||||
|
||||
} else if (TCP_SEQ_GEQ (Tcb->SndWl2 + Tcb->SndWnd, Seq)) {
|
||||
Len = TCP_SUB_SEQ (Tcb->SndWl2 + Tcb->SndWnd, Seq);
|
||||
|
||||
} else {
|
||||
DEBUG (
|
||||
(DEBUG_WARN,
|
||||
"TcpRetransmit: retransmission cancelled because send window too small for TCB %p\n",
|
||||
Tcb)
|
||||
"TcpRetransmit: retransmission cancelled because send window too small for TCB %p\n",
|
||||
Tcb)
|
||||
);
|
||||
|
||||
return 0;
|
||||
@@ -746,16 +723,17 @@ OnError:
|
||||
**/
|
||||
INTN
|
||||
TcpCheckSndQue (
|
||||
IN LIST_ENTRY *Head
|
||||
IN LIST_ENTRY *Head
|
||||
)
|
||||
{
|
||||
LIST_ENTRY *Entry;
|
||||
NET_BUF *Nbuf;
|
||||
TCP_SEQNO Seq;
|
||||
LIST_ENTRY *Entry;
|
||||
NET_BUF *Nbuf;
|
||||
TCP_SEQNO Seq;
|
||||
|
||||
if (IsListEmpty (Head)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
//
|
||||
// Initialize the Seq.
|
||||
//
|
||||
@@ -796,24 +774,23 @@ TcpCheckSndQue (
|
||||
**/
|
||||
INTN
|
||||
TcpToSendData (
|
||||
IN OUT TCP_CB *Tcb,
|
||||
IN INTN Force
|
||||
IN OUT TCP_CB *Tcb,
|
||||
IN INTN Force
|
||||
)
|
||||
{
|
||||
UINT32 Len;
|
||||
INTN Sent;
|
||||
UINT8 Flag;
|
||||
NET_BUF *Nbuf;
|
||||
TCP_SEG *Seg;
|
||||
TCP_SEQNO Seq;
|
||||
TCP_SEQNO End;
|
||||
UINT32 Len;
|
||||
INTN Sent;
|
||||
UINT8 Flag;
|
||||
NET_BUF *Nbuf;
|
||||
TCP_SEG *Seg;
|
||||
TCP_SEQNO Seq;
|
||||
TCP_SEQNO End;
|
||||
|
||||
ASSERT ((Tcb != NULL) && (Tcb->Sk != NULL) && (Tcb->State != TCP_LISTEN));
|
||||
|
||||
Sent = 0;
|
||||
|
||||
if ((Tcb->State == TCP_CLOSED) || TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_FIN_SENT)) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -821,14 +798,13 @@ TcpToSendData (
|
||||
//
|
||||
// Compute how much data can be sent
|
||||
//
|
||||
Len = TcpDataToSend (Tcb, Force);
|
||||
Seq = Tcb->SndNxt;
|
||||
Len = TcpDataToSend (Tcb, Force);
|
||||
Seq = Tcb->SndNxt;
|
||||
|
||||
ASSERT ((Tcb->State) < (ARRAY_SIZE (mTcpOutFlag)));
|
||||
Flag = mTcpOutFlag[Tcb->State];
|
||||
Flag = mTcpOutFlag[Tcb->State];
|
||||
|
||||
if ((Flag & TCP_FLG_SYN) != 0) {
|
||||
|
||||
Seq = Tcb->Iss;
|
||||
Len = 0;
|
||||
}
|
||||
@@ -846,8 +822,8 @@ TcpToSendData (
|
||||
if (Nbuf == NULL) {
|
||||
DEBUG (
|
||||
(DEBUG_ERROR,
|
||||
"TcpToSendData: failed to get a segment for TCB %p\n",
|
||||
Tcb)
|
||||
"TcpToSendData: failed to get a segment for TCB %p\n",
|
||||
Tcb)
|
||||
);
|
||||
|
||||
goto OnError;
|
||||
@@ -872,12 +848,13 @@ TcpToSendData (
|
||||
if ((TcpGetMaxSndNxt (Tcb) == Tcb->SndNxt) &&
|
||||
(GET_SND_DATASIZE (Tcb->Sk) == 0) &&
|
||||
TCP_SEQ_LT (End + 1, Tcb->SndWnd + Tcb->SndWl2)
|
||||
) {
|
||||
)
|
||||
{
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"TcpToSendData: send FIN to peer for TCB %p in state %s\n",
|
||||
Tcb,
|
||||
mTcpStateName[Tcb->State])
|
||||
"TcpToSendData: send FIN to peer for TCB %p in state %s\n",
|
||||
Tcb,
|
||||
mTcpStateName[Tcb->State])
|
||||
);
|
||||
|
||||
End++;
|
||||
@@ -890,11 +867,11 @@ TcpToSendData (
|
||||
Seg->End = End;
|
||||
Seg->Flag = Flag;
|
||||
|
||||
if (TcpVerifySegment (Nbuf) == 0 || TcpCheckSndQue (&Tcb->SndQue) == 0) {
|
||||
if ((TcpVerifySegment (Nbuf) == 0) || (TcpCheckSndQue (&Tcb->SndQue) == 0)) {
|
||||
DEBUG (
|
||||
(DEBUG_ERROR,
|
||||
"TcpToSendData: discard a broken segment for TCB %p\n",
|
||||
Tcb)
|
||||
"TcpToSendData: discard a broken segment for TCB %p\n",
|
||||
Tcb)
|
||||
);
|
||||
goto OnError;
|
||||
}
|
||||
@@ -905,8 +882,8 @@ TcpToSendData (
|
||||
if (Seg->End == Seg->Seq) {
|
||||
DEBUG (
|
||||
(DEBUG_WARN,
|
||||
"TcpToSendData: created a empty segment for TCB %p, free it now\n",
|
||||
Tcb)
|
||||
"TcpToSendData: created a empty segment for TCB %p, free it now\n",
|
||||
Tcb)
|
||||
);
|
||||
|
||||
goto OnError;
|
||||
@@ -916,7 +893,7 @@ TcpToSendData (
|
||||
NetbufTrim (Nbuf, (Nbuf->Tcp->HeadLen << 2), NET_BUF_HEAD);
|
||||
Nbuf->Tcp = NULL;
|
||||
|
||||
if ((Flag & TCP_FLG_FIN) != 0) {
|
||||
if ((Flag & TCP_FLG_FIN) != 0) {
|
||||
TCP_SET_FLG (Tcb->CtrlFlag, TCP_CTRL_FIN_SENT);
|
||||
}
|
||||
|
||||
@@ -957,19 +934,17 @@ TcpToSendData (
|
||||
// Karn's algorithm requires not to update RTT when in loss.
|
||||
//
|
||||
if ((Tcb->CongestState == TCP_CONGEST_OPEN) && !TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_RTT_ON)) {
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"TcpToSendData: set RTT measure sequence %d for TCB %p\n",
|
||||
Seq,
|
||||
Tcb)
|
||||
"TcpToSendData: set RTT measure sequence %d for TCB %p\n",
|
||||
Seq,
|
||||
Tcb)
|
||||
);
|
||||
|
||||
TCP_SET_FLG (Tcb->CtrlFlag, TCP_CTRL_RTT_ON);
|
||||
Tcb->RttSeq = Seq;
|
||||
Tcb->RttMeasure = 0;
|
||||
}
|
||||
|
||||
} while (Len == Tcb->SndMss);
|
||||
|
||||
return Sent;
|
||||
@@ -990,11 +965,11 @@ OnError:
|
||||
**/
|
||||
VOID
|
||||
TcpSendAck (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
)
|
||||
{
|
||||
NET_BUF *Nbuf;
|
||||
TCP_SEG *Seg;
|
||||
NET_BUF *Nbuf;
|
||||
TCP_SEG *Seg;
|
||||
|
||||
Nbuf = NetbufAlloc (TCP_MAX_HEAD);
|
||||
|
||||
@@ -1028,11 +1003,11 @@ TcpSendAck (
|
||||
**/
|
||||
INTN
|
||||
TcpSendZeroProbe (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
)
|
||||
{
|
||||
NET_BUF *Nbuf;
|
||||
TCP_SEG *Seg;
|
||||
NET_BUF *Nbuf;
|
||||
TCP_SEG *Seg;
|
||||
INTN Result;
|
||||
|
||||
Nbuf = NetbufAlloc (TCP_MAX_HEAD);
|
||||
@@ -1052,7 +1027,7 @@ TcpSendZeroProbe (
|
||||
Seg->End = Tcb->SndNxt - 1;
|
||||
Seg->Flag = TCP_FLG_ACK;
|
||||
|
||||
Result = TcpTransmitSegment (Tcb, Nbuf);
|
||||
Result = TcpTransmitSegment (Tcb, Nbuf);
|
||||
NetbufFree (Nbuf);
|
||||
|
||||
return Result;
|
||||
@@ -1066,10 +1041,10 @@ TcpSendZeroProbe (
|
||||
**/
|
||||
VOID
|
||||
TcpToSendAck (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
)
|
||||
{
|
||||
UINT32 TcpNow;
|
||||
UINT32 TcpNow;
|
||||
|
||||
//
|
||||
// Generally, TCP should send a delayed ACK unless:
|
||||
@@ -1091,8 +1066,8 @@ TcpToSendAck (
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_NET,
|
||||
"TcpToSendAck: scheduled a delayed ACK for TCB %p\n",
|
||||
Tcb)
|
||||
"TcpToSendAck: scheduled a delayed ACK for TCB %p\n",
|
||||
Tcb)
|
||||
);
|
||||
|
||||
//
|
||||
@@ -1143,7 +1118,7 @@ TcpSendReset (
|
||||
return -1;
|
||||
}
|
||||
|
||||
Nhead = (TCP_HEAD *) NetbufAllocSpace (
|
||||
Nhead = (TCP_HEAD *)NetbufAllocSpace (
|
||||
Nbuf,
|
||||
sizeof (TCP_HEAD),
|
||||
NET_BUF_TAIL
|
||||
@@ -1159,25 +1134,23 @@ TcpSendReset (
|
||||
// is associated with it, otherwise derive from the Tcb.
|
||||
//
|
||||
if (Tcb == NULL) {
|
||||
|
||||
if (TCP_FLG_ON (Head->Flag, TCP_FLG_ACK)) {
|
||||
Nhead->Seq = Head->Ack;
|
||||
Nhead->Ack = 0;
|
||||
Nhead->Seq = Head->Ack;
|
||||
Nhead->Ack = 0;
|
||||
} else {
|
||||
Nhead->Seq = 0;
|
||||
TCP_SET_FLG (Nhead->Flag, TCP_FLG_ACK);
|
||||
Nhead->Ack = HTONL (NTOHL (Head->Seq) + Len);
|
||||
}
|
||||
} else {
|
||||
|
||||
Nhead->Seq = HTONL (Tcb->SndNxt);
|
||||
Nhead->Ack = HTONL (Tcb->RcvNxt);
|
||||
Nhead->Seq = HTONL (Tcb->SndNxt);
|
||||
Nhead->Ack = HTONL (Tcb->RcvNxt);
|
||||
TCP_SET_FLG (Nhead->Flag, TCP_FLG_ACK);
|
||||
}
|
||||
|
||||
Nhead->SrcPort = Head->DstPort;
|
||||
Nhead->DstPort = Head->SrcPort;
|
||||
Nhead->HeadLen = (UINT8) (sizeof (TCP_HEAD) >> 2);
|
||||
Nhead->HeadLen = (UINT8)(sizeof (TCP_HEAD) >> 2);
|
||||
Nhead->Res = 0;
|
||||
Nhead->Wnd = HTONS (0xFFFF);
|
||||
Nhead->Checksum = 0;
|
||||
@@ -1209,7 +1182,7 @@ TcpSendReset (
|
||||
**/
|
||||
INTN
|
||||
TcpVerifySegment (
|
||||
IN NET_BUF *Nbuf
|
||||
IN NET_BUF *Nbuf
|
||||
)
|
||||
{
|
||||
TCP_HEAD *Head;
|
||||
@@ -1222,9 +1195,9 @@ TcpVerifySegment (
|
||||
|
||||
NET_CHECK_SIGNATURE (Nbuf, NET_BUF_SIGNATURE);
|
||||
|
||||
Seg = TCPSEG_NETBUF (Nbuf);
|
||||
Len = Nbuf->TotalSize;
|
||||
Head = Nbuf->Tcp;
|
||||
Seg = TCPSEG_NETBUF (Nbuf);
|
||||
Len = Nbuf->TotalSize;
|
||||
Head = Nbuf->Tcp;
|
||||
|
||||
if (Head != NULL) {
|
||||
if (Head->Flag != Seg->Flag) {
|
||||
|
@@ -26,109 +26,107 @@
|
||||
#define TCP_CLOSE_WAIT 9
|
||||
#define TCP_LAST_ACK 10
|
||||
|
||||
|
||||
///
|
||||
/// Flags in the TCP header
|
||||
///
|
||||
#define TCP_FLG_FIN 0x01
|
||||
#define TCP_FLG_SYN 0x02
|
||||
#define TCP_FLG_RST 0x04
|
||||
#define TCP_FLG_PSH 0x08
|
||||
#define TCP_FLG_ACK 0x10
|
||||
#define TCP_FLG_URG 0x20
|
||||
#define TCP_FLG_FIN 0x01
|
||||
#define TCP_FLG_SYN 0x02
|
||||
#define TCP_FLG_RST 0x04
|
||||
#define TCP_FLG_PSH 0x08
|
||||
#define TCP_FLG_ACK 0x10
|
||||
#define TCP_FLG_URG 0x20
|
||||
|
||||
//
|
||||
// mask for all the flags
|
||||
//
|
||||
#define TCP_FLG_FLAG 0x3F
|
||||
//
|
||||
// mask for all the flags
|
||||
//
|
||||
#define TCP_FLG_FLAG 0x3F
|
||||
|
||||
|
||||
#define TCP_CONNECT_REFUSED (-1) ///< TCP error status
|
||||
#define TCP_CONNECT_RESET (-2) ///< TCP error status
|
||||
#define TCP_CONNECT_CLOSED (-3) ///< TCP error status
|
||||
#define TCP_CONNECT_REFUSED (-1) ///< TCP error status
|
||||
#define TCP_CONNECT_RESET (-2) ///< TCP error status
|
||||
#define TCP_CONNECT_CLOSED (-3) ///< TCP error status
|
||||
|
||||
//
|
||||
// Current congestion status as suggested by RFC3782.
|
||||
//
|
||||
#define TCP_CONGEST_RECOVER 1 ///< During the NewReno fast recovery.
|
||||
#define TCP_CONGEST_LOSS 2 ///< Retxmit because of retxmit time out.
|
||||
#define TCP_CONGEST_OPEN 3 ///< TCP is opening its congestion window.
|
||||
#define TCP_CONGEST_RECOVER 1 ///< During the NewReno fast recovery.
|
||||
#define TCP_CONGEST_LOSS 2 ///< Retxmit because of retxmit time out.
|
||||
#define TCP_CONGEST_OPEN 3 ///< TCP is opening its congestion window.
|
||||
|
||||
//
|
||||
// TCP control flags
|
||||
//
|
||||
#define TCP_CTRL_NO_NAGLE 0x0001 ///< Disable Nagle algorithm
|
||||
#define TCP_CTRL_NO_KEEPALIVE 0x0002 ///< Disable keepalive timer.
|
||||
#define TCP_CTRL_NO_WS 0x0004 ///< Disable window scale option.
|
||||
#define TCP_CTRL_RCVD_WS 0x0008 ///< Received a wnd scale option in syn.
|
||||
#define TCP_CTRL_NO_TS 0x0010 ///< Disable Timestamp option.
|
||||
#define TCP_CTRL_RCVD_TS 0x0020 ///< Received a Timestamp option in syn.
|
||||
#define TCP_CTRL_SND_TS 0x0040 ///< Send Timestamp option to remote.
|
||||
#define TCP_CTRL_SND_URG 0x0080 ///< In urgent send mode.
|
||||
#define TCP_CTRL_RCVD_URG 0x0100 ///< In urgent receive mode.
|
||||
#define TCP_CTRL_SND_PSH 0x0200 ///< In PUSH send mode.
|
||||
#define TCP_CTRL_FIN_SENT 0x0400 ///< FIN is sent.
|
||||
#define TCP_CTRL_FIN_ACKED 0x0800 ///< FIN is ACKed.
|
||||
#define TCP_CTRL_TIMER_ON 0x1000 ///< At least one of the timer is on.
|
||||
#define TCP_CTRL_RTT_ON 0x2000 ///< The RTT measurement is on.
|
||||
#define TCP_CTRL_ACK_NOW 0x4000 ///< Send the ACK now, don't delay.
|
||||
#define TCP_CTRL_NO_NAGLE 0x0001 ///< Disable Nagle algorithm
|
||||
#define TCP_CTRL_NO_KEEPALIVE 0x0002 ///< Disable keepalive timer.
|
||||
#define TCP_CTRL_NO_WS 0x0004 ///< Disable window scale option.
|
||||
#define TCP_CTRL_RCVD_WS 0x0008 ///< Received a wnd scale option in syn.
|
||||
#define TCP_CTRL_NO_TS 0x0010 ///< Disable Timestamp option.
|
||||
#define TCP_CTRL_RCVD_TS 0x0020 ///< Received a Timestamp option in syn.
|
||||
#define TCP_CTRL_SND_TS 0x0040 ///< Send Timestamp option to remote.
|
||||
#define TCP_CTRL_SND_URG 0x0080 ///< In urgent send mode.
|
||||
#define TCP_CTRL_RCVD_URG 0x0100 ///< In urgent receive mode.
|
||||
#define TCP_CTRL_SND_PSH 0x0200 ///< In PUSH send mode.
|
||||
#define TCP_CTRL_FIN_SENT 0x0400 ///< FIN is sent.
|
||||
#define TCP_CTRL_FIN_ACKED 0x0800 ///< FIN is ACKed.
|
||||
#define TCP_CTRL_TIMER_ON 0x1000 ///< At least one of the timer is on.
|
||||
#define TCP_CTRL_RTT_ON 0x2000 ///< The RTT measurement is on.
|
||||
#define TCP_CTRL_ACK_NOW 0x4000 ///< Send the ACK now, don't delay.
|
||||
|
||||
//
|
||||
// Timer related values
|
||||
//
|
||||
#define TCP_TIMER_CONNECT 0 ///< Connection establishment timer.
|
||||
#define TCP_TIMER_REXMIT 1 ///< Retransmit timer.
|
||||
#define TCP_TIMER_PROBE 2 ///< Window probe timer.
|
||||
#define TCP_TIMER_KEEPALIVE 3 ///< Keepalive timer.
|
||||
#define TCP_TIMER_FINWAIT2 4 ///< FIN_WAIT_2 timer.
|
||||
#define TCP_TIMER_2MSL 5 ///< TIME_WAIT timer.
|
||||
#define TCP_TIMER_NUMBER 6 ///< The total number of the TCP timer.
|
||||
#define TCP_TICK 200 ///< Every TCP tick is 200ms.
|
||||
#define TCP_TICK_HZ 5 ///< The frequence of TCP tick.
|
||||
#define TCP_RTT_SHIFT 3 ///< SRTT & RTTVAR scaled by 8.
|
||||
#define TCP_RTO_MIN TCP_TICK_HZ ///< The minimum value of RTO.
|
||||
#define TCP_RTO_MAX (TCP_TICK_HZ * 60) ///< The maximum value of RTO.
|
||||
#define TCP_FOLD_RTT 4 ///< Timeout threshold to fold RTT.
|
||||
#define TCP_TIMER_CONNECT 0 ///< Connection establishment timer.
|
||||
#define TCP_TIMER_REXMIT 1 ///< Retransmit timer.
|
||||
#define TCP_TIMER_PROBE 2 ///< Window probe timer.
|
||||
#define TCP_TIMER_KEEPALIVE 3 ///< Keepalive timer.
|
||||
#define TCP_TIMER_FINWAIT2 4 ///< FIN_WAIT_2 timer.
|
||||
#define TCP_TIMER_2MSL 5 ///< TIME_WAIT timer.
|
||||
#define TCP_TIMER_NUMBER 6 ///< The total number of the TCP timer.
|
||||
#define TCP_TICK 200 ///< Every TCP tick is 200ms.
|
||||
#define TCP_TICK_HZ 5 ///< The frequence of TCP tick.
|
||||
#define TCP_RTT_SHIFT 3 ///< SRTT & RTTVAR scaled by 8.
|
||||
#define TCP_RTO_MIN TCP_TICK_HZ ///< The minimum value of RTO.
|
||||
#define TCP_RTO_MAX (TCP_TICK_HZ * 60) ///< The maximum value of RTO.
|
||||
#define TCP_FOLD_RTT 4 ///< Timeout threshold to fold RTT.
|
||||
|
||||
//
|
||||
// Default values for some timers
|
||||
//
|
||||
#define TCP_MAX_LOSS 12 ///< Default max times to retxmit.
|
||||
#define TCP_KEEPALIVE_IDLE_MIN (TCP_TICK_HZ * 60 * 60 * 2) ///< First keepalive.
|
||||
#define TCP_KEEPALIVE_PERIOD (TCP_TICK_HZ * 60)
|
||||
#define TCP_MAX_KEEPALIVE 8
|
||||
#define TCP_FIN_WAIT2_TIME (2 * TCP_TICK_HZ)
|
||||
#define TCP_TIME_WAIT_TIME (2 * TCP_TICK_HZ)
|
||||
#define TCP_PAWS_24DAY (24 * 24 * 60 * 60 * TCP_TICK_HZ)
|
||||
#define TCP_CONNECT_TIME (75 * TCP_TICK_HZ)
|
||||
#define TCP_MAX_LOSS 12 ///< Default max times to retxmit.
|
||||
#define TCP_KEEPALIVE_IDLE_MIN (TCP_TICK_HZ * 60 * 60 * 2) ///< First keepalive.
|
||||
#define TCP_KEEPALIVE_PERIOD (TCP_TICK_HZ * 60)
|
||||
#define TCP_MAX_KEEPALIVE 8
|
||||
#define TCP_FIN_WAIT2_TIME (2 * TCP_TICK_HZ)
|
||||
#define TCP_TIME_WAIT_TIME (2 * TCP_TICK_HZ)
|
||||
#define TCP_PAWS_24DAY (24 * 24 * 60 * 60 * TCP_TICK_HZ)
|
||||
#define TCP_CONNECT_TIME (75 * TCP_TICK_HZ)
|
||||
|
||||
//
|
||||
// The header space to be reserved before TCP data to accommodate:
|
||||
// 60byte IP head + 60byte TCP head + link layer head
|
||||
//
|
||||
#define TCP_MAX_HEAD 192
|
||||
#define TCP_MAX_HEAD 192
|
||||
|
||||
//
|
||||
// Value ranges for some control option
|
||||
//
|
||||
#define TCP_RCV_BUF_SIZE (2 * 1024 * 1024)
|
||||
#define TCP_RCV_BUF_SIZE_MIN (8 * 1024)
|
||||
#define TCP_SND_BUF_SIZE (2 * 1024 * 1024)
|
||||
#define TCP_SND_BUF_SIZE_MIN (8 * 1024)
|
||||
#define TCP_BACKLOG 10
|
||||
#define TCP_BACKLOG_MIN 5
|
||||
#define TCP_MAX_LOSS_MIN 6
|
||||
#define TCP_CONNECT_TIME_MIN (60 * TCP_TICK_HZ)
|
||||
#define TCP_MAX_KEEPALIVE_MIN 4
|
||||
#define TCP_KEEPALIVE_IDLE_MAX (TCP_TICK_HZ * 60 * 60 * 4)
|
||||
#define TCP_KEEPALIVE_PERIOD_MIN (TCP_TICK_HZ * 30)
|
||||
#define TCP_FIN_WAIT2_TIME_MAX (4 * TCP_TICK_HZ)
|
||||
#define TCP_TIME_WAIT_TIME_MAX (60 * TCP_TICK_HZ)
|
||||
#define TCP_RCV_BUF_SIZE (2 * 1024 * 1024)
|
||||
#define TCP_RCV_BUF_SIZE_MIN (8 * 1024)
|
||||
#define TCP_SND_BUF_SIZE (2 * 1024 * 1024)
|
||||
#define TCP_SND_BUF_SIZE_MIN (8 * 1024)
|
||||
#define TCP_BACKLOG 10
|
||||
#define TCP_BACKLOG_MIN 5
|
||||
#define TCP_MAX_LOSS_MIN 6
|
||||
#define TCP_CONNECT_TIME_MIN (60 * TCP_TICK_HZ)
|
||||
#define TCP_MAX_KEEPALIVE_MIN 4
|
||||
#define TCP_KEEPALIVE_IDLE_MAX (TCP_TICK_HZ * 60 * 60 * 4)
|
||||
#define TCP_KEEPALIVE_PERIOD_MIN (TCP_TICK_HZ * 30)
|
||||
#define TCP_FIN_WAIT2_TIME_MAX (4 * TCP_TICK_HZ)
|
||||
#define TCP_TIME_WAIT_TIME_MAX (60 * TCP_TICK_HZ)
|
||||
|
||||
///
|
||||
/// TCP_CONNECTED: both ends have synchronized their ISN.
|
||||
///
|
||||
#define TCP_CONNECTED(state) ((state) > TCP_SYN_RCVD)
|
||||
#define TCP_CONNECTED(state) ((state) > TCP_SYN_RCVD)
|
||||
|
||||
#define TCP_FIN_RCVD(State) \
|
||||
( \
|
||||
@@ -150,30 +148,30 @@
|
||||
//
|
||||
// Get the TCP_SEG point from a net buffer's ProtoData.
|
||||
//
|
||||
#define TCPSEG_NETBUF(NBuf) ((TCP_SEG *) ((NBuf)->ProtoData))
|
||||
#define TCPSEG_NETBUF(NBuf) ((TCP_SEG *) ((NBuf)->ProtoData))
|
||||
|
||||
//
|
||||
// Macros to compare sequence no
|
||||
//
|
||||
#define TCP_SEQ_LT(SeqA, SeqB) ((INT32) ((SeqA) - (SeqB)) < 0)
|
||||
#define TCP_SEQ_LEQ(SeqA, SeqB) ((INT32) ((SeqA) - (SeqB)) <= 0)
|
||||
#define TCP_SEQ_GT(SeqA, SeqB) ((INT32) ((SeqB) - (SeqA)) < 0)
|
||||
#define TCP_SEQ_GEQ(SeqA, SeqB) ((INT32) ((SeqB) - (SeqA)) <= 0)
|
||||
#define TCP_SEQ_LT(SeqA, SeqB) ((INT32) ((SeqA) - (SeqB)) < 0)
|
||||
#define TCP_SEQ_LEQ(SeqA, SeqB) ((INT32) ((SeqA) - (SeqB)) <= 0)
|
||||
#define TCP_SEQ_GT(SeqA, SeqB) ((INT32) ((SeqB) - (SeqA)) < 0)
|
||||
#define TCP_SEQ_GEQ(SeqA, SeqB) ((INT32) ((SeqB) - (SeqA)) <= 0)
|
||||
|
||||
//
|
||||
// TCP_SEQ_BETWEEN return whether b <= m <= e
|
||||
//
|
||||
#define TCP_SEQ_BETWEEN(b, m, e) ((e) - (b) >= (m) - (b))
|
||||
#define TCP_SEQ_BETWEEN(b, m, e) ((e) - (b) >= (m) - (b))
|
||||
|
||||
//
|
||||
// TCP_SUB_SEQ returns Seq1 - Seq2. Make sure Seq1 >= Seq2
|
||||
//
|
||||
#define TCP_SUB_SEQ(Seq1, Seq2) ((UINT32) ((Seq1) - (Seq2)))
|
||||
#define TCP_SUB_SEQ(Seq1, Seq2) ((UINT32) ((Seq1) - (Seq2)))
|
||||
|
||||
//
|
||||
// Check whether Flag is on
|
||||
//
|
||||
#define TCP_FLG_ON(Value, Flag) ((BOOLEAN) (((Value) & (Flag)) != 0))
|
||||
#define TCP_FLG_ON(Value, Flag) ((BOOLEAN) (((Value) & (Flag)) != 0))
|
||||
//
|
||||
// Set and Clear operation on a Flag
|
||||
//
|
||||
@@ -200,145 +198,143 @@
|
||||
#define TCP_SET_TIMER(Flag, Timer) ((Flag) = (UINT16) ((Flag) | (1 << (Timer))))
|
||||
#define TCP_CLEAR_TIMER(Flag, Timer) ((Flag) = (UINT16) ((Flag) & (~(1 << (Timer)))))
|
||||
|
||||
#define TCP_TIME_LT(Ta, Tb) ((INT32) ((Ta) - (Tb)) < 0)
|
||||
#define TCP_TIME_LEQ(Ta, Tb) ((INT32) ((Ta) - (Tb)) <= 0)
|
||||
#define TCP_SUB_TIME(Ta, Tb) ((UINT32) ((Ta) - (Tb)))
|
||||
|
||||
#define TCP_TIME_LT(Ta, Tb) ((INT32) ((Ta) - (Tb)) < 0)
|
||||
#define TCP_TIME_LEQ(Ta, Tb) ((INT32) ((Ta) - (Tb)) <= 0)
|
||||
#define TCP_SUB_TIME(Ta, Tb) ((UINT32) ((Ta) - (Tb)))
|
||||
|
||||
#define TCP_MAX_WIN 0xFFFFU
|
||||
#define TCP_MAX_WIN 0xFFFFU
|
||||
|
||||
///
|
||||
/// TCP segmentation data.
|
||||
///
|
||||
typedef struct _TCP_SEG {
|
||||
TCP_SEQNO Seq; ///< Starting sequence number.
|
||||
TCP_SEQNO End; ///< The sequence of the last byte + 1, include SYN/FIN. End-Seq = SEG.LEN.
|
||||
TCP_SEQNO Ack; ///< ACK field in the segment.
|
||||
UINT8 Flag; ///< TCP header flags.
|
||||
UINT16 Urg; ///< Valid if URG flag is set.
|
||||
UINT32 Wnd; ///< TCP window size field.
|
||||
TCP_SEQNO Seq; ///< Starting sequence number.
|
||||
TCP_SEQNO End; ///< The sequence of the last byte + 1, include SYN/FIN. End-Seq = SEG.LEN.
|
||||
TCP_SEQNO Ack; ///< ACK field in the segment.
|
||||
UINT8 Flag; ///< TCP header flags.
|
||||
UINT16 Urg; ///< Valid if URG flag is set.
|
||||
UINT32 Wnd; ///< TCP window size field.
|
||||
} TCP_SEG;
|
||||
|
||||
///
|
||||
/// Network endpoint, IP plus Port structure.
|
||||
///
|
||||
typedef struct _TCP_PEER {
|
||||
EFI_IP_ADDRESS Ip; ///< IP address, in network byte order.
|
||||
TCP_PORTNO Port; ///< Port number, in network byte order.
|
||||
EFI_IP_ADDRESS Ip; ///< IP address, in network byte order.
|
||||
TCP_PORTNO Port; ///< Port number, in network byte order.
|
||||
} TCP_PEER;
|
||||
|
||||
typedef struct _TCP_CONTROL_BLOCK TCP_CB;
|
||||
typedef struct _TCP_CONTROL_BLOCK TCP_CB;
|
||||
|
||||
///
|
||||
/// TCP control block: it includes various states.
|
||||
///
|
||||
struct _TCP_CONTROL_BLOCK {
|
||||
LIST_ENTRY List; ///< Back and forward link entry
|
||||
TCP_CB *Parent; ///< The parent TCP_CB structure
|
||||
LIST_ENTRY List; ///< Back and forward link entry
|
||||
TCP_CB *Parent; ///< The parent TCP_CB structure
|
||||
|
||||
SOCKET *Sk; ///< The socket it controlled.
|
||||
TCP_PEER LocalEnd; ///< Local endpoint.
|
||||
TCP_PEER RemoteEnd;///< Remote endpoint.
|
||||
SOCKET *Sk; ///< The socket it controlled.
|
||||
TCP_PEER LocalEnd; ///< Local endpoint.
|
||||
TCP_PEER RemoteEnd; ///< Remote endpoint.
|
||||
|
||||
LIST_ENTRY SndQue; ///< Retxmission queue.
|
||||
LIST_ENTRY RcvQue; ///< Reassemble queue.
|
||||
UINT32 CtrlFlag; ///< Control flags, such as NO_NAGLE.
|
||||
INT32 Error; ///< Soft error status, such as TCP_CONNECT_RESET.
|
||||
LIST_ENTRY SndQue; ///< Retxmission queue.
|
||||
LIST_ENTRY RcvQue; ///< Reassemble queue.
|
||||
UINT32 CtrlFlag; ///< Control flags, such as NO_NAGLE.
|
||||
INT32 Error; ///< Soft error status, such as TCP_CONNECT_RESET.
|
||||
|
||||
//
|
||||
// RFC793 and RFC1122 defined variables
|
||||
//
|
||||
UINT8 State; ///< TCP state, such as SYN_SENT, LISTEN.
|
||||
UINT8 DelayedAck; ///< Number of delayed ACKs.
|
||||
UINT16 HeadSum; ///< Checksum of the fixed parts of pesudo
|
||||
///< header: Src IP, Dst IP, 0, Protocol,
|
||||
///< do not include the TCP length.
|
||||
UINT8 State; ///< TCP state, such as SYN_SENT, LISTEN.
|
||||
UINT8 DelayedAck; ///< Number of delayed ACKs.
|
||||
UINT16 HeadSum; ///< Checksum of the fixed parts of pesudo
|
||||
///< header: Src IP, Dst IP, 0, Protocol,
|
||||
///< do not include the TCP length.
|
||||
|
||||
TCP_SEQNO Iss; ///< Initial Sending Sequence.
|
||||
TCP_SEQNO SndUna; ///< First unacknowledged data.
|
||||
TCP_SEQNO SndNxt; ///< Next data sequence to send.
|
||||
TCP_SEQNO SndPsh; ///< Send PUSH point.
|
||||
TCP_SEQNO SndUp; ///< Send urgent point.
|
||||
UINT32 SndWnd; ///< Window advertised by the remote peer.
|
||||
UINT32 SndWndMax; ///< Max send window advertised by the peer.
|
||||
TCP_SEQNO SndWl1; ///< Seq number used for last window update.
|
||||
TCP_SEQNO SndWl2; ///< Ack no of last window update.
|
||||
UINT16 SndMss; ///< Max send segment size.
|
||||
TCP_SEQNO RcvNxt; ///< Next sequence no to receive.
|
||||
UINT32 RcvWnd; ///< Window advertised by the local peer.
|
||||
TCP_SEQNO RcvWl2; ///< The RcvNxt (or ACK) of last window update.
|
||||
///< It is necessary because of delayed ACK.
|
||||
TCP_SEQNO Iss; ///< Initial Sending Sequence.
|
||||
TCP_SEQNO SndUna; ///< First unacknowledged data.
|
||||
TCP_SEQNO SndNxt; ///< Next data sequence to send.
|
||||
TCP_SEQNO SndPsh; ///< Send PUSH point.
|
||||
TCP_SEQNO SndUp; ///< Send urgent point.
|
||||
UINT32 SndWnd; ///< Window advertised by the remote peer.
|
||||
UINT32 SndWndMax; ///< Max send window advertised by the peer.
|
||||
TCP_SEQNO SndWl1; ///< Seq number used for last window update.
|
||||
TCP_SEQNO SndWl2; ///< Ack no of last window update.
|
||||
UINT16 SndMss; ///< Max send segment size.
|
||||
TCP_SEQNO RcvNxt; ///< Next sequence no to receive.
|
||||
UINT32 RcvWnd; ///< Window advertised by the local peer.
|
||||
TCP_SEQNO RcvWl2; ///< The RcvNxt (or ACK) of last window update.
|
||||
///< It is necessary because of delayed ACK.
|
||||
|
||||
TCP_SEQNO RcvUp; ///< Urgent point;
|
||||
TCP_SEQNO Irs; ///< Initial Receiving Sequence.
|
||||
UINT16 RcvMss; ///< Max receive segment size.
|
||||
UINT16 EnabledTimer; ///< Which timer is currently enabled.
|
||||
UINT32 Timer[TCP_TIMER_NUMBER]; ///< When the timer will expire.
|
||||
INT32 NextExpire; ///< Countdown offset for the nearest timer.
|
||||
UINT32 Idle; ///< How long the connection is in idle.
|
||||
UINT32 ProbeTime; ///< The time out value for current window prober.
|
||||
BOOLEAN ProbeTimerOn;///< If TRUE, the probe time is on.
|
||||
TCP_SEQNO RcvUp; ///< Urgent point;
|
||||
TCP_SEQNO Irs; ///< Initial Receiving Sequence.
|
||||
UINT16 RcvMss; ///< Max receive segment size.
|
||||
UINT16 EnabledTimer; ///< Which timer is currently enabled.
|
||||
UINT32 Timer[TCP_TIMER_NUMBER]; ///< When the timer will expire.
|
||||
INT32 NextExpire; ///< Countdown offset for the nearest timer.
|
||||
UINT32 Idle; ///< How long the connection is in idle.
|
||||
UINT32 ProbeTime; ///< The time out value for current window prober.
|
||||
BOOLEAN ProbeTimerOn; ///< If TRUE, the probe time is on.
|
||||
|
||||
//
|
||||
// RFC1323 defined variables, about window scale,
|
||||
// timestamp and PAWS
|
||||
//
|
||||
UINT8 SndWndScale; ///< Wndscale received from the peer.
|
||||
UINT8 RcvWndScale; ///< Wndscale used to scale local buffer.
|
||||
UINT32 TsRecent; ///< TsRecent to echo to the remote peer.
|
||||
UINT32 TsRecentAge; ///< When this TsRecent is updated.
|
||||
UINT8 SndWndScale; ///< Wndscale received from the peer.
|
||||
UINT8 RcvWndScale; ///< Wndscale used to scale local buffer.
|
||||
UINT32 TsRecent; ///< TsRecent to echo to the remote peer.
|
||||
UINT32 TsRecentAge; ///< When this TsRecent is updated.
|
||||
|
||||
//
|
||||
// RFC2988 defined variables. about RTT measurement
|
||||
//
|
||||
TCP_SEQNO RttSeq; ///< The seq of measured segment now.
|
||||
UINT32 RttMeasure; ///< Currently measured RTT in heartbeats.
|
||||
UINT32 SRtt; ///< Smoothed RTT, scaled by 8.
|
||||
UINT32 RttVar; ///< RTT variance, scaled by 8.
|
||||
UINT32 Rto; ///< Current RTO, not scaled.
|
||||
TCP_SEQNO RttSeq; ///< The seq of measured segment now.
|
||||
UINT32 RttMeasure; ///< Currently measured RTT in heartbeats.
|
||||
UINT32 SRtt; ///< Smoothed RTT, scaled by 8.
|
||||
UINT32 RttVar; ///< RTT variance, scaled by 8.
|
||||
UINT32 Rto; ///< Current RTO, not scaled.
|
||||
|
||||
//
|
||||
// RFC2581, and 3782 variables.
|
||||
// Congestion control + NewReno fast recovery.
|
||||
//
|
||||
UINT32 CWnd; ///< Sender's congestion window.
|
||||
UINT32 Ssthresh; ///< Slow start threshold.
|
||||
TCP_SEQNO Recover; ///< Recover point for NewReno.
|
||||
UINT16 DupAck; ///< Number of duplicate ACKs.
|
||||
UINT8 CongestState; ///< The current congestion state(RFC3782).
|
||||
UINT8 LossTimes; ///< Number of retxmit timeouts in a row.
|
||||
TCP_SEQNO LossRecover; ///< Recover point for retxmit.
|
||||
UINT32 CWnd; ///< Sender's congestion window.
|
||||
UINT32 Ssthresh; ///< Slow start threshold.
|
||||
TCP_SEQNO Recover; ///< Recover point for NewReno.
|
||||
UINT16 DupAck; ///< Number of duplicate ACKs.
|
||||
UINT8 CongestState; ///< The current congestion state(RFC3782).
|
||||
UINT8 LossTimes; ///< Number of retxmit timeouts in a row.
|
||||
TCP_SEQNO LossRecover; ///< Recover point for retxmit.
|
||||
|
||||
//
|
||||
// RFC7323
|
||||
// Addressing Window Retraction for TCP Window Scale Option.
|
||||
//
|
||||
TCP_SEQNO RetxmitSeqMax; ///< Max Seq number in previous retransmission.
|
||||
TCP_SEQNO RetxmitSeqMax; ///< Max Seq number in previous retransmission.
|
||||
|
||||
//
|
||||
// configuration parameters, for EFI_TCP4_PROTOCOL specification
|
||||
//
|
||||
UINT32 KeepAliveIdle; ///< Idle time before sending first probe.
|
||||
UINT32 KeepAlivePeriod; ///< Interval for subsequent keep alive probe.
|
||||
UINT8 MaxKeepAlive; ///< Maximum keep alive probe times.
|
||||
UINT8 KeepAliveProbes; ///< The number of keep alive probe.
|
||||
UINT16 MaxRexmit; ///< The maximum number of retxmit before abort.
|
||||
UINT32 FinWait2Timeout; ///< The FIN_WAIT_2 timeout.
|
||||
UINT32 TimeWaitTimeout; ///< The TIME_WAIT timeout.
|
||||
UINT32 ConnectTimeout; ///< The connect establishment timeout.
|
||||
UINT32 KeepAliveIdle; ///< Idle time before sending first probe.
|
||||
UINT32 KeepAlivePeriod; ///< Interval for subsequent keep alive probe.
|
||||
UINT8 MaxKeepAlive; ///< Maximum keep alive probe times.
|
||||
UINT8 KeepAliveProbes; ///< The number of keep alive probe.
|
||||
UINT16 MaxRexmit; ///< The maximum number of retxmit before abort.
|
||||
UINT32 FinWait2Timeout; ///< The FIN_WAIT_2 timeout.
|
||||
UINT32 TimeWaitTimeout; ///< The TIME_WAIT timeout.
|
||||
UINT32 ConnectTimeout; ///< The connect establishment timeout.
|
||||
|
||||
//
|
||||
// configuration for tcp provided by user
|
||||
//
|
||||
BOOLEAN UseDefaultAddr;
|
||||
UINT8 Tos;
|
||||
UINT8 Ttl;
|
||||
EFI_IPv4_ADDRESS SubnetMask;
|
||||
BOOLEAN UseDefaultAddr;
|
||||
UINT8 Tos;
|
||||
UINT8 Ttl;
|
||||
EFI_IPv4_ADDRESS SubnetMask;
|
||||
|
||||
|
||||
BOOLEAN RemoteIpZero; ///< RemoteEnd.Ip is ZERO when configured.
|
||||
IP_IO_IP_INFO *IpInfo; ///< Pointer reference to Ip used to send pkt
|
||||
UINT32 Tick; ///< 1 tick = 200ms
|
||||
BOOLEAN RemoteIpZero; ///< RemoteEnd.Ip is ZERO when configured.
|
||||
IP_IO_IP_INFO *IpInfo; ///< Pointer reference to Ip used to send pkt
|
||||
UINT32 Tick; ///< 1 tick = 200ms
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "TcpMain.h"
|
||||
|
||||
UINT32 mTcpTick = 1000;
|
||||
UINT32 mTcpTick = 1000;
|
||||
|
||||
/**
|
||||
Connect timeout handler.
|
||||
@@ -19,7 +19,7 @@ UINT32 mTcpTick = 1000;
|
||||
**/
|
||||
VOID
|
||||
TcpConnectTimeout (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -30,7 +30,7 @@ TcpConnectTimeout (
|
||||
**/
|
||||
VOID
|
||||
TcpRexmitTimeout (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -41,7 +41,7 @@ TcpRexmitTimeout (
|
||||
**/
|
||||
VOID
|
||||
TcpProbeTimeout (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -52,7 +52,7 @@ TcpProbeTimeout (
|
||||
**/
|
||||
VOID
|
||||
TcpKeepaliveTimeout (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -63,7 +63,7 @@ TcpKeepaliveTimeout (
|
||||
**/
|
||||
VOID
|
||||
TcpFinwait2Timeout (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -74,10 +74,10 @@ TcpFinwait2Timeout (
|
||||
**/
|
||||
VOID
|
||||
Tcp2MSLTimeout (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
);
|
||||
|
||||
TCP_TIMER_HANDLER mTcpTimerHandler[TCP_TIMER_NUMBER] = {
|
||||
TCP_TIMER_HANDLER mTcpTimerHandler[TCP_TIMER_NUMBER] = {
|
||||
TcpConnectTimeout,
|
||||
TcpRexmitTimeout,
|
||||
TcpProbeTimeout,
|
||||
@@ -94,7 +94,7 @@ TCP_TIMER_HANDLER mTcpTimerHandler[TCP_TIMER_NUMBER] = {
|
||||
**/
|
||||
VOID
|
||||
TcpClose (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
)
|
||||
{
|
||||
NetbufFreeList (&Tcb->SndQue);
|
||||
@@ -111,7 +111,7 @@ TcpClose (
|
||||
**/
|
||||
VOID
|
||||
TcpBackoffRto (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -121,16 +121,14 @@ TcpBackoffRto (
|
||||
//
|
||||
if ((Tcb->LossTimes >= TCP_FOLD_RTT) && (Tcb->SRtt != 0)) {
|
||||
Tcb->RttVar += Tcb->SRtt >> 2;
|
||||
Tcb->SRtt = 0;
|
||||
Tcb->SRtt = 0;
|
||||
}
|
||||
|
||||
Tcb->Rto <<= 1;
|
||||
|
||||
if (Tcb->Rto < TCP_RTO_MIN) {
|
||||
|
||||
Tcb->Rto = TCP_RTO_MIN;
|
||||
} else if (Tcb->Rto > TCP_RTO_MAX) {
|
||||
|
||||
Tcb->Rto = TCP_RTO_MAX;
|
||||
}
|
||||
}
|
||||
@@ -143,14 +141,14 @@ TcpBackoffRto (
|
||||
**/
|
||||
VOID
|
||||
TcpConnectTimeout (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
)
|
||||
{
|
||||
if (!TCP_CONNECTED (Tcb->State)) {
|
||||
DEBUG (
|
||||
(DEBUG_ERROR,
|
||||
"TcpConnectTimeout: connection closed because connection timer timeout for TCB %p\n",
|
||||
Tcb)
|
||||
"TcpConnectTimeout: connection closed because connection timer timeout for TCB %p\n",
|
||||
Tcb)
|
||||
);
|
||||
|
||||
if (EFI_ABORTED == Tcb->Sk->SockError) {
|
||||
@@ -160,19 +158,17 @@ TcpConnectTimeout (
|
||||
if (TCP_SYN_RCVD == Tcb->State) {
|
||||
DEBUG (
|
||||
(DEBUG_WARN,
|
||||
"TcpConnectTimeout: send reset because connection timer timeout for TCB %p\n",
|
||||
Tcb)
|
||||
"TcpConnectTimeout: send reset because connection timer timeout for TCB %p\n",
|
||||
Tcb)
|
||||
);
|
||||
|
||||
TcpResetConnection (Tcb);
|
||||
|
||||
}
|
||||
|
||||
TcpClose (Tcb);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Timeout handler for TCP retransmission timer.
|
||||
|
||||
@@ -181,15 +177,15 @@ TcpConnectTimeout (
|
||||
**/
|
||||
VOID
|
||||
TcpRexmitTimeout (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
)
|
||||
{
|
||||
UINT32 FlightSize;
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_WARN,
|
||||
"TcpRexmitTimeout: transmission timeout for TCB %p\n",
|
||||
Tcb)
|
||||
"TcpRexmitTimeout: transmission timeout for TCB %p\n",
|
||||
Tcb)
|
||||
);
|
||||
|
||||
//
|
||||
@@ -197,19 +193,18 @@ TcpRexmitTimeout (
|
||||
// amount of data that has been sent but not
|
||||
// yet ACKed.
|
||||
//
|
||||
FlightSize = TCP_SUB_SEQ (Tcb->SndNxt, Tcb->SndUna);
|
||||
Tcb->Ssthresh = MAX ((UINT32) (2 * Tcb->SndMss), FlightSize / 2);
|
||||
FlightSize = TCP_SUB_SEQ (Tcb->SndNxt, Tcb->SndUna);
|
||||
Tcb->Ssthresh = MAX ((UINT32)(2 * Tcb->SndMss), FlightSize / 2);
|
||||
|
||||
Tcb->CWnd = Tcb->SndMss;
|
||||
Tcb->LossRecover = Tcb->SndNxt;
|
||||
Tcb->CWnd = Tcb->SndMss;
|
||||
Tcb->LossRecover = Tcb->SndNxt;
|
||||
|
||||
Tcb->LossTimes++;
|
||||
if ((Tcb->LossTimes > Tcb->MaxRexmit) && !TCP_TIMER_ON (Tcb->EnabledTimer, TCP_TIMER_CONNECT)) {
|
||||
|
||||
DEBUG (
|
||||
(DEBUG_ERROR,
|
||||
"TcpRexmitTimeout: connection closed because too many timeouts for TCB %p\n",
|
||||
Tcb)
|
||||
"TcpRexmitTimeout: connection closed because too many timeouts for TCB %p\n",
|
||||
Tcb)
|
||||
);
|
||||
|
||||
if (EFI_ABORTED == Tcb->Sk->SockError) {
|
||||
@@ -217,7 +212,7 @@ TcpRexmitTimeout (
|
||||
}
|
||||
|
||||
TcpClose (Tcb);
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
TcpBackoffRto (Tcb);
|
||||
@@ -237,7 +232,7 @@ TcpRexmitTimeout (
|
||||
**/
|
||||
VOID
|
||||
TcpProbeTimeout (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -247,10 +242,9 @@ TcpProbeTimeout (
|
||||
// the probe timer, since retransmit timer is on.
|
||||
//
|
||||
if ((TcpDataToSend (Tcb, 1) != 0) && (TcpToSendData (Tcb, 1) > 0)) {
|
||||
|
||||
ASSERT (TCP_TIMER_ON (Tcb->EnabledTimer, TCP_TIMER_REXMIT) != 0);
|
||||
Tcb->ProbeTimerOn = FALSE;
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
TcpSendZeroProbe (Tcb);
|
||||
@@ -265,7 +259,7 @@ TcpProbeTimeout (
|
||||
**/
|
||||
VOID
|
||||
TcpKeepaliveTimeout (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
)
|
||||
{
|
||||
Tcb->KeepAliveProbes++;
|
||||
@@ -274,13 +268,12 @@ TcpKeepaliveTimeout (
|
||||
// Too many Keep-alive probes, drop the connection
|
||||
//
|
||||
if (Tcb->KeepAliveProbes > Tcb->MaxKeepAlive) {
|
||||
|
||||
if (EFI_ABORTED == Tcb->Sk->SockError) {
|
||||
SOCK_ERROR (Tcb->Sk, EFI_TIMEOUT);
|
||||
}
|
||||
|
||||
TcpClose (Tcb);
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
TcpSendZeroProbe (Tcb);
|
||||
@@ -295,13 +288,13 @@ TcpKeepaliveTimeout (
|
||||
**/
|
||||
VOID
|
||||
TcpFinwait2Timeout (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
)
|
||||
{
|
||||
DEBUG (
|
||||
(DEBUG_WARN,
|
||||
"TcpFinwait2Timeout: connection closed because FIN_WAIT2 timer timeouts for TCB %p\n",
|
||||
Tcb)
|
||||
"TcpFinwait2Timeout: connection closed because FIN_WAIT2 timer timeouts for TCB %p\n",
|
||||
Tcb)
|
||||
);
|
||||
|
||||
TcpClose (Tcb);
|
||||
@@ -315,13 +308,13 @@ TcpFinwait2Timeout (
|
||||
**/
|
||||
VOID
|
||||
Tcp2MSLTimeout (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
)
|
||||
{
|
||||
DEBUG (
|
||||
(DEBUG_WARN,
|
||||
"Tcp2MSLTimeout: connection closed because TIME_WAIT timer timeouts for TCB %p\n",
|
||||
Tcb)
|
||||
"Tcp2MSLTimeout: connection closed because TIME_WAIT timer timeouts for TCB %p\n",
|
||||
Tcb)
|
||||
);
|
||||
|
||||
TcpClose (Tcb);
|
||||
@@ -336,7 +329,7 @@ Tcp2MSLTimeout (
|
||||
**/
|
||||
VOID
|
||||
TcpUpdateTimer (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
)
|
||||
{
|
||||
UINT16 Index;
|
||||
@@ -349,11 +342,10 @@ TcpUpdateTimer (
|
||||
TCP_CLEAR_FLG (Tcb->CtrlFlag, TCP_CTRL_TIMER_ON);
|
||||
|
||||
for (Index = 0; Index < TCP_TIMER_NUMBER; Index++) {
|
||||
|
||||
if (TCP_TIMER_ON (Tcb->EnabledTimer, Index) &&
|
||||
TCP_TIME_LT (Tcb->Timer[Index], mTcpTick + Tcb->NextExpire)
|
||||
) {
|
||||
|
||||
)
|
||||
{
|
||||
Tcb->NextExpire = TCP_SUB_TIME (Tcb->Timer[Index], mTcpTick);
|
||||
TCP_SET_FLG (Tcb->CtrlFlag, TCP_CTRL_TIMER_ON);
|
||||
}
|
||||
@@ -370,9 +362,9 @@ TcpUpdateTimer (
|
||||
**/
|
||||
VOID
|
||||
TcpSetTimer (
|
||||
IN OUT TCP_CB *Tcb,
|
||||
IN UINT16 Timer,
|
||||
IN UINT32 TimeOut
|
||||
IN OUT TCP_CB *Tcb,
|
||||
IN UINT16 Timer,
|
||||
IN UINT32 TimeOut
|
||||
)
|
||||
{
|
||||
TCP_SET_TIMER (Tcb->EnabledTimer, Timer);
|
||||
@@ -390,8 +382,8 @@ TcpSetTimer (
|
||||
**/
|
||||
VOID
|
||||
TcpClearTimer (
|
||||
IN OUT TCP_CB *Tcb,
|
||||
IN UINT16 Timer
|
||||
IN OUT TCP_CB *Tcb,
|
||||
IN UINT16 Timer
|
||||
)
|
||||
{
|
||||
TCP_CLEAR_TIMER (Tcb->EnabledTimer, Timer);
|
||||
@@ -406,7 +398,7 @@ TcpClearTimer (
|
||||
**/
|
||||
VOID
|
||||
TcpClearAllTimer (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
)
|
||||
{
|
||||
Tcb->EnabledTimer = 0;
|
||||
@@ -421,22 +413,19 @@ TcpClearAllTimer (
|
||||
**/
|
||||
VOID
|
||||
TcpSetProbeTimer (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
)
|
||||
{
|
||||
if (!Tcb->ProbeTimerOn) {
|
||||
Tcb->ProbeTime = Tcb->Rto;
|
||||
Tcb->ProbeTimerOn = TRUE;
|
||||
|
||||
} else {
|
||||
Tcb->ProbeTime <<= 1;
|
||||
}
|
||||
|
||||
if (Tcb->ProbeTime < TCP_RTO_MIN) {
|
||||
|
||||
Tcb->ProbeTime = TCP_RTO_MIN;
|
||||
} else if (Tcb->ProbeTime > TCP_RTO_MAX) {
|
||||
|
||||
Tcb->ProbeTime = TCP_RTO_MAX;
|
||||
}
|
||||
|
||||
@@ -451,12 +440,11 @@ TcpSetProbeTimer (
|
||||
**/
|
||||
VOID
|
||||
TcpSetKeepaliveTimer (
|
||||
IN OUT TCP_CB *Tcb
|
||||
IN OUT TCP_CB *Tcb
|
||||
)
|
||||
{
|
||||
if (TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_NO_KEEPALIVE)) {
|
||||
return ;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -468,13 +456,11 @@ TcpSetKeepaliveTimer (
|
||||
//
|
||||
if (!TCP_TIMER_ON (Tcb->EnabledTimer, TCP_TIMER_KEEPALIVE) ||
|
||||
(Tcb->Idle < Tcb->KeepAliveIdle)
|
||||
) {
|
||||
|
||||
)
|
||||
{
|
||||
TcpSetTimer (Tcb, TCP_TIMER_KEEPALIVE, Tcb->KeepAliveIdle);
|
||||
Tcb->KeepAliveProbes = 0;
|
||||
|
||||
} else {
|
||||
|
||||
TcpSetTimer (Tcb, TCP_TIMER_KEEPALIVE, Tcb->KeepAlivePeriod);
|
||||
}
|
||||
}
|
||||
@@ -488,13 +474,13 @@ TcpSetKeepaliveTimer (
|
||||
VOID
|
||||
EFIAPI
|
||||
TcpTickingDpc (
|
||||
IN VOID *Context
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
LIST_ENTRY *Entry;
|
||||
LIST_ENTRY *Next;
|
||||
TCP_CB *Tcb;
|
||||
INT16 Index;
|
||||
LIST_ENTRY *Entry;
|
||||
LIST_ENTRY *Next;
|
||||
TCP_CB *Tcb;
|
||||
INT16 Index;
|
||||
|
||||
mTcpTick++;
|
||||
mTcpGlobalIss += TCP_ISS_INCREMENT_2;
|
||||
@@ -503,14 +489,14 @@ TcpTickingDpc (
|
||||
// Don't use LIST_FOR_EACH, which isn't delete safe.
|
||||
//
|
||||
for (Entry = mTcpRunQue.ForwardLink; Entry != &mTcpRunQue; Entry = Next) {
|
||||
Next = Entry->ForwardLink;
|
||||
|
||||
Next = Entry->ForwardLink;
|
||||
|
||||
Tcb = NET_LIST_USER_STRUCT (Entry, TCP_CB, List);
|
||||
Tcb = NET_LIST_USER_STRUCT (Entry, TCP_CB, List);
|
||||
|
||||
if (Tcb->State == TCP_CLOSED) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// The connection is doing RTT measurement.
|
||||
//
|
||||
@@ -524,7 +510,7 @@ TcpTickingDpc (
|
||||
TcpSendAck (Tcb);
|
||||
}
|
||||
|
||||
if (Tcb->IpInfo->IpVersion == IP_VERSION_6 && Tcb->Tick > 0) {
|
||||
if ((Tcb->IpInfo->IpVersion == IP_VERSION_6) && (Tcb->Tick > 0)) {
|
||||
Tcb->Tick--;
|
||||
}
|
||||
|
||||
@@ -532,7 +518,6 @@ TcpTickingDpc (
|
||||
// No timer is active or no timer expired
|
||||
//
|
||||
if (!TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_TIMER_ON) || ((--Tcb->NextExpire) > 0)) {
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -540,7 +525,6 @@ TcpTickingDpc (
|
||||
// Call the timeout handler for each expired timer.
|
||||
//
|
||||
for (Index = 0; Index < TCP_TIMER_NUMBER; Index++) {
|
||||
|
||||
if (TCP_TIMER_ON (Tcb->EnabledTimer, Index) && TCP_TIME_LEQ (Tcb->Timer[Index], mTcpTick)) {
|
||||
//
|
||||
// disable the timer before calling the handler
|
||||
@@ -578,8 +562,8 @@ TcpTickingDpc (
|
||||
VOID
|
||||
EFIAPI
|
||||
TcpTicking (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
QueueDpc (TPL_CALLBACK, TcpTickingDpc, Context);
|
||||
|
Reference in New Issue
Block a user