diff options
author | Tian, Hot <hot.tian@intel.com> | 2014-01-22 08:38:50 +0000 |
---|---|---|
committer | hhtian <hhtian@6f19259b-4bc3-4df7-8a09-765794883524> | 2014-01-22 08:38:50 +0000 |
commit | 4b738c76f56f8eda171f14b8f9b20e34b66be476 (patch) | |
tree | 353ba43c75023a7d0a88c59389e4bb2ba7c94f0c /MdeModulePkg/Library/DxeTcpIoLib | |
parent | 4c8f6044a2ae275071ab6cd6557b584784c093ce (diff) | |
download | edk2-4b738c76f56f8eda171f14b8f9b20e34b66be476.tar.gz edk2-4b738c76f56f8eda171f14b8f9b20e34b66be476.tar.bz2 edk2-4b738c76f56f8eda171f14b8f9b20e34b66be476.zip |
Fix CRLF format
Signed-off-by: Tian, Hot <hot.tian@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15155 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Library/DxeTcpIoLib')
-rw-r--r-- | MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c | 424 |
1 files changed, 212 insertions, 212 deletions
diff --git a/MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c b/MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c index 730ccb2caf..17183e1a6c 100644 --- a/MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c +++ b/MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c @@ -22,92 +22,92 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include <Library/MemoryAllocationLib.h>
#include <Library/BaseMemoryLib.h>
-/** +/**
The common notify function associated with various TcpIo events.
- - @param[in] Event The event signaled. - @param[in] Context The context. - -**/ -VOID -EFIAPI +
+ @param[in] Event The event signaled.
+ @param[in] Context The context.
+
+**/
+VOID
+EFIAPI
TcpIoCommonNotify (
- IN EFI_EVENT Event, - IN VOID *Context - ) + IN EFI_EVENT Event,
+ IN VOID *Context
+ )
{
if ((Event == NULL) || (Context == NULL)) {
return ;
}
- *((BOOLEAN *) Context) = TRUE; + *((BOOLEAN *) Context) = TRUE;
}
-/** +/**
The internal function for delay configuring TCP6 when IP6 driver is still in DAD.
- - @param[in] Tcp6 The EFI_TCP6_PROTOCOL protocol instance. - @param[in] Tcp6ConfigData The Tcp6 configuration data. - - @retval EFI_SUCCESS The operational settings successfully - completed. +
+ @param[in] Tcp6 The EFI_TCP6_PROTOCOL protocol instance.
+ @param[in] Tcp6ConfigData The Tcp6 configuration data.
+
+ @retval EFI_SUCCESS The operational settings successfully
+ completed.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
@retval Others Failed to finish the operation.
-**/ -EFI_STATUS +**/
+EFI_STATUS
TcpIoGetMapping (
- IN EFI_TCP6_PROTOCOL *Tcp6, - IN EFI_TCP6_CONFIG_DATA *Tcp6ConfigData - ) -{ - EFI_STATUS Status; - EFI_EVENT Event; + IN EFI_TCP6_PROTOCOL *Tcp6,
+ IN EFI_TCP6_CONFIG_DATA *Tcp6ConfigData
+ )
+{
+ EFI_STATUS Status;
+ EFI_EVENT Event;
if ((Tcp6 == NULL) || (Tcp6ConfigData == NULL)) {
return EFI_INVALID_PARAMETER;
}
- Event = NULL; - Status = gBS->CreateEvent ( - EVT_TIMER, - TPL_CALLBACK, - NULL, - NULL, - &Event - ); - if (EFI_ERROR (Status)) { - goto ON_EXIT; - } - - Status = gBS->SetTimer ( - Event, - TimerRelative, + Event = NULL;
+ Status = gBS->CreateEvent (
+ EVT_TIMER,
+ TPL_CALLBACK,
+ NULL,
+ NULL,
+ &Event
+ );
+ if (EFI_ERROR (Status)) {
+ goto ON_EXIT;
+ }
+
+ Status = gBS->SetTimer (
+ Event,
+ TimerRelative,
TCP_GET_MAPPING_TIMEOUT
- ); - - if (EFI_ERROR (Status)) { - goto ON_EXIT; - } - - while (EFI_ERROR (gBS->CheckEvent (Event))) { - - Tcp6->Poll (Tcp6); - - Status = Tcp6->Configure (Tcp6, Tcp6ConfigData); - - if (!EFI_ERROR (Status)) { - break; - } - } - -ON_EXIT: - - if (Event != NULL) { - gBS->CloseEvent (Event); - } - - return Status; + );
+
+ if (EFI_ERROR (Status)) {
+ goto ON_EXIT;
+ }
+
+ while (EFI_ERROR (gBS->CheckEvent (Event))) {
+
+ Tcp6->Poll (Tcp6);
+
+ Status = Tcp6->Configure (Tcp6, Tcp6ConfigData);
+
+ if (!EFI_ERROR (Status)) {
+ break;
+ }
+ }
+
+ON_EXIT:
+
+ if (Event != NULL) {
+ gBS->CloseEvent (Event);
+ }
+
+ return Status;
}
/**
@@ -121,7 +121,7 @@ ON_EXIT: @retval EFI_SUCCESS The TCP socket is created and configured.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
- @retval EFI_UNSUPPORTED One or more of the control options are not + @retval EFI_UNSUPPORTED One or more of the control options are not
supported in the implementation.
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
@retval Others Failed to create the TCP socket or configure it.
@@ -177,26 +177,26 @@ TcpIoCreateSocket ( //
// Create the TCP child instance and get the TCP protocol.
//
- Status = NetLibCreateServiceChild ( - Controller, - Image, + Status = NetLibCreateServiceChild (
+ Controller,
+ Image,
ServiceBindingGuid,
&TcpIo->Handle
- ); - if (EFI_ERROR (Status)) { - return Status; - } - - Status = gBS->OpenProtocol ( + );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = gBS->OpenProtocol (
TcpIo->Handle,
ProtocolGuid,
Interface,
- Image, - Controller, - EFI_OPEN_PROTOCOL_BY_DRIVER - ); + Image,
+ Controller,
+ EFI_OPEN_PROTOCOL_BY_DRIVER
+ );
if (EFI_ERROR (Status) || (*Interface == NULL)) {
- goto ON_ERROR; + goto ON_ERROR;
}
if (TcpVersion == TCP_VERSION_4) {
@@ -204,28 +204,28 @@ TcpIoCreateSocket ( } else {
Tcp6 = TcpIo->Tcp.Tcp6;
}
- +
TcpIo->Image = Image;
TcpIo->Controller = Controller;
- - // - // Set the configuration parameters. - // - ControlOption.ReceiveBufferSize = 0x200000; - ControlOption.SendBufferSize = 0x200000; - ControlOption.MaxSynBackLog = 0; - ControlOption.ConnectionTimeout = 0; - ControlOption.DataRetries = 6; - ControlOption.FinTimeout = 0; - ControlOption.TimeWaitTimeout = 0; - ControlOption.KeepAliveProbes = 4; - ControlOption.KeepAliveTime = 0; - ControlOption.KeepAliveInterval = 0; - ControlOption.EnableNagle = FALSE; - ControlOption.EnableTimeStamp = FALSE; - ControlOption.EnableWindowScaling = TRUE; - ControlOption.EnableSelectiveAck = FALSE; - ControlOption.EnablePathMtuDiscovery = FALSE; +
+ //
+ // Set the configuration parameters.
+ //
+ ControlOption.ReceiveBufferSize = 0x200000;
+ ControlOption.SendBufferSize = 0x200000;
+ ControlOption.MaxSynBackLog = 0;
+ ControlOption.ConnectionTimeout = 0;
+ ControlOption.DataRetries = 6;
+ ControlOption.FinTimeout = 0;
+ ControlOption.TimeWaitTimeout = 0;
+ ControlOption.KeepAliveProbes = 4;
+ ControlOption.KeepAliveTime = 0;
+ ControlOption.KeepAliveInterval = 0;
+ ControlOption.EnableNagle = FALSE;
+ ControlOption.EnableTimeStamp = FALSE;
+ ControlOption.EnableWindowScaling = TRUE;
+ ControlOption.EnableSelectiveAck = FALSE;
+ ControlOption.EnablePathMtuDiscovery = FALSE;
if (TcpVersion == TCP_VERSION_4) {
Tcp4ConfigData.TypeOfService = 8;
@@ -309,59 +309,59 @@ TcpIoCreateSocket ( }
}
- // - // Create events for variuos asynchronous operations. + //
+ // Create events for variuos asynchronous operations.
//
Status = gBS->CreateEvent (
- EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, + EVT_NOTIFY_SIGNAL,
+ TPL_NOTIFY,
TcpIoCommonNotify,
&TcpIo->IsConnDone,
&Event
- ); - if (EFI_ERROR (Status)) { - goto ON_ERROR; + );
+ if (EFI_ERROR (Status)) {
+ goto ON_ERROR;
}
TcpIo->ConnToken.Tcp4Token.CompletionToken.Event = Event;
- Status = gBS->CreateEvent ( - EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, + Status = gBS->CreateEvent (
+ EVT_NOTIFY_SIGNAL,
+ TPL_NOTIFY,
TcpIoCommonNotify,
&TcpIo->IsListenDone,
&Event
- ); - if (EFI_ERROR (Status)) { - goto ON_ERROR; + );
+ if (EFI_ERROR (Status)) {
+ goto ON_ERROR;
}
TcpIo->ListenToken.Tcp4Token.CompletionToken.Event = Event;
- Status = gBS->CreateEvent ( - EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, + Status = gBS->CreateEvent (
+ EVT_NOTIFY_SIGNAL,
+ TPL_NOTIFY,
TcpIoCommonNotify,
&TcpIo->IsTxDone,
&Event
- ); - if (EFI_ERROR (Status)) { - goto ON_ERROR; - } + );
+ if (EFI_ERROR (Status)) {
+ goto ON_ERROR;
+ }
TcpIo->TxToken.Tcp4Token.CompletionToken.Event = Event;
- Status = gBS->CreateEvent ( - EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, + Status = gBS->CreateEvent (
+ EVT_NOTIFY_SIGNAL,
+ TPL_NOTIFY,
TcpIoCommonNotify,
&TcpIo->IsRxDone,
&Event
- ); - if (EFI_ERROR (Status)) { - goto ON_ERROR; - } + );
+ if (EFI_ERROR (Status)) {
+ goto ON_ERROR;
+ }
TcpIo->RxToken.Tcp4Token.CompletionToken.Event = Event;
@@ -373,26 +373,26 @@ TcpIoCreateSocket ( TcpIo->RxToken.Tcp4Token.Packet.RxData = RxData;
- Status = gBS->CreateEvent ( - EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, + Status = gBS->CreateEvent (
+ EVT_NOTIFY_SIGNAL,
+ TPL_NOTIFY,
TcpIoCommonNotify,
&TcpIo->IsCloseDone,
&Event
- ); - if (EFI_ERROR (Status)) { - goto ON_ERROR; - } + );
+ if (EFI_ERROR (Status)) {
+ goto ON_ERROR;
+ }
TcpIo->CloseToken.Tcp4Token.CompletionToken.Event = Event;
return EFI_SUCCESS;
- -ON_ERROR: +
+ON_ERROR:
TcpIoDestroySocket (TcpIo);
- +
return Status;
}
@@ -482,7 +482,7 @@ TcpIoDestroySocket ( if ((Tcp4 != NULL) || (Tcp6 != NULL)) {
- gBS->CloseProtocol ( + gBS->CloseProtocol (
TcpIo->Handle,
ProtocolGuid,
TcpIo->Image,
@@ -518,7 +518,7 @@ TcpIoDestroySocket ( }
}
- NetLibDestroyServiceChild ( + NetLibDestroyServiceChild (
TcpIo->Controller,
TcpIo->Image,
ServiceBindingGuid,
@@ -572,24 +572,24 @@ TcpIoConnect ( return EFI_UNSUPPORTED;
}
- if (EFI_ERROR (Status)) { - return Status; - } - + if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
while (!TcpIo->IsConnDone && EFI_ERROR (gBS->CheckEvent (Timeout))) {
if (TcpIo->TcpVersion == TCP_VERSION_4) {
Tcp4->Poll (Tcp4);
} else {
Tcp6->Poll (Tcp6);
}
- } - + }
+
if (!TcpIo->IsConnDone) {
- Status = EFI_TIMEOUT; + Status = EFI_TIMEOUT;
} else {
Status = TcpIo->ConnToken.Tcp4Token.CompletionToken.Status;
}
- +
return Status;
}
@@ -642,8 +642,8 @@ TcpIoAccept ( return EFI_UNSUPPORTED;
}
- if (EFI_ERROR (Status)) { - return Status; + if (EFI_ERROR (Status)) {
+ return Status;
}
while (!TcpIo->IsListenDone && EFI_ERROR (gBS->CheckEvent (Timeout))) {
@@ -652,18 +652,18 @@ TcpIoAccept ( } else {
Tcp6->Poll (Tcp6);
}
- } + }
if (!TcpIo->IsListenDone) {
- Status = EFI_TIMEOUT; + Status = EFI_TIMEOUT;
} else {
Status = TcpIo->ListenToken.Tcp4Token.CompletionToken.Status;
}
- // - // The new TCP instance handle created for the established connection is - // in ListenToken. - // + //
+ // The new TCP instance handle created for the established connection is
+ // in ListenToken.
+ //
if (!EFI_ERROR (Status)) {
if (TcpIo->TcpVersion == TCP_VERSION_4) {
ProtocolGuid = &gEfiTcp4ProtocolGuid;
@@ -671,16 +671,16 @@ TcpIoAccept ( ProtocolGuid = &gEfiTcp6ProtocolGuid;
}
- Status = gBS->OpenProtocol ( + Status = gBS->OpenProtocol (
TcpIo->ListenToken.Tcp4Token.NewChildHandle,
ProtocolGuid,
(VOID **) (&TcpIo->NewTcp.Tcp4),
TcpIo->Image,
TcpIo->Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER - ); - - } + EFI_OPEN_PROTOCOL_BY_DRIVER
+ );
+
+ }
return Status;
}
@@ -721,10 +721,10 @@ TcpIoReset ( return ;
}
- if (EFI_ERROR (Status)) { - return ; - } - + if (EFI_ERROR (Status)) {
+ return ;
+ }
+
while (!TcpIo->IsCloseDone) {
if (TcpIo->TcpVersion == TCP_VERSION_4) {
Tcp4->Poll (Tcp4);
@@ -780,16 +780,16 @@ TcpIoTransmit ( Data = AllocatePool (Size);
if (Data == NULL) {
- return EFI_OUT_OF_RESOURCES; + return EFI_OUT_OF_RESOURCES;
}
((EFI_TCP4_TRANSMIT_DATA *) Data)->Push = TRUE;
((EFI_TCP4_TRANSMIT_DATA *) Data)->Urgent = FALSE;
((EFI_TCP4_TRANSMIT_DATA *) Data)->DataLength = Packet->TotalSize;
- // - // Build the fragment table. - // + //
+ // Build the fragment table.
+ //
((EFI_TCP4_TRANSMIT_DATA *) Data)->FragmentCount = Packet->BlockOpNum;
NetbufBuildExt (
@@ -802,8 +802,8 @@ TcpIoTransmit ( Tcp6 = NULL;
Status = EFI_DEVICE_ERROR;
- // - // Trasnmit the packet. + //
+ // Trasnmit the packet.
//
if (TcpIo->TcpVersion == TCP_VERSION_4) {
TcpIo->TxToken.Tcp4Token.Packet.TxData = (EFI_TCP4_TRANSMIT_DATA *) Data;
@@ -831,25 +831,25 @@ TcpIoTransmit ( Status = Tcp6->Transmit (Tcp6, &TcpIo->TxToken.Tcp6Token);
}
- if (EFI_ERROR (Status)) { - goto ON_EXIT; - } - + if (EFI_ERROR (Status)) {
+ goto ON_EXIT;
+ }
+
while (!TcpIo->IsTxDone) {
if (TcpIo->TcpVersion == TCP_VERSION_4) {
Tcp4->Poll (Tcp4);
} else {
Tcp6->Poll (Tcp6);
}
- } - + }
+
TcpIo->IsTxDone = FALSE;
Status = TcpIo->TxToken.Tcp4Token.CompletionToken.Status;
-ON_EXIT: - +ON_EXIT:
+
FreePool (Data);
- +
return Status;
}
@@ -926,22 +926,22 @@ TcpIoReceive ( return EFI_UNSUPPORTED;
}
- FragmentCount = Packet->BlockOpNum; - Fragment = AllocatePool (FragmentCount * sizeof (NET_FRAGMENT)); + FragmentCount = Packet->BlockOpNum;
+ Fragment = AllocatePool (FragmentCount * sizeof (NET_FRAGMENT));
if (Fragment == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto ON_EXIT;
- } - // - // Build the fragment table. - // - NetbufBuildExt (Packet, Fragment, &FragmentCount); + }
+ //
+ // Build the fragment table.
+ //
+ NetbufBuildExt (Packet, Fragment, &FragmentCount);
RxData->FragmentCount = 1;
CurrentFragment = 0;
- Status = EFI_SUCCESS; - - while (CurrentFragment < FragmentCount) { + Status = EFI_SUCCESS;
+
+ while (CurrentFragment < FragmentCount) {
RxData->DataLength = Fragment[CurrentFragment].Len;
RxData->FragmentTable[0].FragmentLength = Fragment[CurrentFragment].Len;
RxData->FragmentTable[0].FragmentBuffer = Fragment[CurrentFragment].Bulk;
@@ -952,9 +952,9 @@ TcpIoReceive ( Status = Tcp6->Receive (Tcp6, &TcpIo->RxToken.Tcp6Token);
}
- if (EFI_ERROR (Status)) { - goto ON_EXIT; - } + if (EFI_ERROR (Status)) {
+ goto ON_EXIT;
+ }
while (!TcpIo->IsRxDone && ((Timeout == NULL) || EFI_ERROR (gBS->CheckEvent (Timeout)))) {
//
@@ -966,42 +966,42 @@ TcpIoReceive ( Tcp6->Poll (Tcp6);
}
}
- +
if (!TcpIo->IsRxDone) {
- // - // Timeout occurs, cancel the receive request. - // + //
+ // Timeout occurs, cancel the receive request.
+ //
if (TcpIo->TcpVersion == TCP_VERSION_4) {
Tcp4->Cancel (Tcp4, &TcpIo->RxToken.Tcp4Token.CompletionToken);
} else {
Tcp6->Cancel (Tcp6, &TcpIo->RxToken.Tcp6Token.CompletionToken);
}
- - Status = EFI_TIMEOUT; - goto ON_EXIT; - } else { +
+ Status = EFI_TIMEOUT;
+ goto ON_EXIT;
+ } else {
TcpIo->IsRxDone = FALSE;
}
Status = TcpIo->RxToken.Tcp4Token.CompletionToken.Status;
if (EFI_ERROR (Status)) {
- goto ON_EXIT; - } - + goto ON_EXIT;
+ }
+
Fragment[CurrentFragment].Len -= RxData->FragmentTable[0].FragmentLength;
- if (Fragment[CurrentFragment].Len == 0) { - CurrentFragment++; - } else { + if (Fragment[CurrentFragment].Len == 0) {
+ CurrentFragment++;
+ } else {
Fragment[CurrentFragment].Bulk += RxData->FragmentTable[0].FragmentLength;
- } - } - -ON_EXIT: + }
+ }
+
+ON_EXIT:
if (Fragment != NULL) {
FreePool (Fragment);
}
- +
return Status;
}
|