NetworkPkg: Clean up source files

1. Do not use tab characters
2. No trailing white space in one line
3. All files must end with CRLF

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Liming Gao
2018-06-27 21:12:32 +08:00
parent 9095d37b8f
commit f75a7f568e
180 changed files with 3642 additions and 3642 deletions

View File

@@ -33,17 +33,17 @@ EFI_HTTP_PROTOCOL mEfiHttpTemplate = {
@param[in] This Pointer to EFI_HTTP_PROTOCOL instance.
@param[out] HttpConfigData Point to buffer for operational parameters of this
HTTP instance. It is the responsibility of the caller
to allocate the memory for HttpConfigData and
HttpConfigData->AccessPoint.IPv6Node/IPv4Node. In fact,
it is recommended to allocate sufficient memory to record
IPv6Node since it is big enough for all possibilities.
HTTP instance. It is the responsibility of the caller
to allocate the memory for HttpConfigData and
HttpConfigData->AccessPoint.IPv6Node/IPv4Node. In fact,
it is recommended to allocate sufficient memory to record
IPv6Node since it is big enough for all possibilities.
@retval EFI_SUCCESS Operation succeeded.
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
This is NULL.
HttpConfigData is NULL.
HttpConfigData->AccessPoint.IPv4Node or
HttpConfigData->AccessPoint.IPv4Node or
HttpConfigData->AccessPoint.IPv6Node is NULL.
@retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been started.
@@ -132,16 +132,16 @@ EFIAPI
EfiHttpConfigure (
IN EFI_HTTP_PROTOCOL *This,
IN EFI_HTTP_CONFIG_DATA *HttpConfigData OPTIONAL
)
)
{
HTTP_PROTOCOL *HttpInstance;
EFI_STATUS Status;
//
// Check input parameters.
//
if (This == NULL ||
(HttpConfigData != NULL &&
(HttpConfigData != NULL &&
((HttpConfigData->LocalAddressIsIPv6 && HttpConfigData->AccessPoint.IPv6Node == NULL) ||
(!HttpConfigData->LocalAddressIsIPv6 && HttpConfigData->AccessPoint.IPv4Node == NULL)))) {
return EFI_INVALID_PARAMETER;
@@ -166,8 +166,8 @@ EfiHttpConfigure (
HttpInstance->HttpVersion = HttpConfigData->HttpVersion;
HttpInstance->TimeOutMillisec = HttpConfigData->TimeOutMillisec;
HttpInstance->LocalAddressIsIPv6 = HttpConfigData->LocalAddressIsIPv6;
if (HttpConfigData->LocalAddressIsIPv6) {
if (HttpConfigData->LocalAddressIsIPv6) {
CopyMem (
&HttpInstance->Ipv6Node,
HttpConfigData->AccessPoint.IPv6Node,
@@ -180,7 +180,7 @@ EfiHttpConfigure (
sizeof (HttpInstance->IPv4Node)
);
}
//
// Creat Tcp child
//
@@ -188,7 +188,7 @@ EfiHttpConfigure (
if (EFI_ERROR (Status)) {
return Status;
}
HttpInstance->State = HTTP_STATE_HTTP_CONFIGED;
return EFI_SUCCESS;
@@ -201,7 +201,7 @@ EfiHttpConfigure (
return EFI_SUCCESS;
}
}
/**
The Request() function queues an HTTP request to this HTTP instance.
@@ -284,8 +284,8 @@ EfiHttpRequest (
// Only support GET, HEAD, DELETE, PATCH, PUT and POST method in current implementation.
//
if ((Request != NULL) && (Request->Method != HttpMethodGet) &&
(Request->Method != HttpMethodHead) && (Request->Method != HttpMethodDelete) &&
(Request->Method != HttpMethodPut) && (Request->Method != HttpMethodPost) &&
(Request->Method != HttpMethodHead) && (Request->Method != HttpMethodDelete) &&
(Request->Method != HttpMethodPut) && (Request->Method != HttpMethodPost) &&
(Request->Method != HttpMethodPatch)) {
return EFI_UNSUPPORTED;
}
@@ -307,8 +307,8 @@ EfiHttpRequest (
//
// Request would be NULL only for PUT/POST/PATCH operation (in the current implementation)
//
if ((HttpInstance->Method != HttpMethodPut) &&
(HttpInstance->Method != HttpMethodPost) &&
if ((HttpInstance->Method != HttpMethodPut) &&
(HttpInstance->Method != HttpMethodPost) &&
(HttpInstance->Method != HttpMethodPatch)) {
return EFI_INVALID_PARAMETER;
}
@@ -358,7 +358,7 @@ EfiHttpRequest (
UnicodeStrToAsciiStrS (Request->Url, Url, UrlLen);
//
// From the information in Url, the HTTP instance will
// From the information in Url, the HTTP instance will
// be able to determine whether to use http or https.
//
HttpInstance->UseHttps = IsHttpsUrl (Url);
@@ -367,7 +367,7 @@ EfiHttpRequest (
// HTTP is disabled, return directly if the URI is not HTTPS.
//
if (!PcdGetBool (PcdAllowHttpConnections) && !(HttpInstance->UseHttps)) {
DEBUG ((EFI_D_ERROR, "EfiHttpRequest: HTTP is disabled.\n"));
return EFI_ACCESS_DENIED;
@@ -434,9 +434,9 @@ EfiHttpRequest (
ReConfigure = FALSE;
} else {
if ((HttpInstance->RemotePort == RemotePort) &&
(AsciiStrCmp (HttpInstance->RemoteHost, HostName) == 0) &&
(!HttpInstance->UseHttps || (HttpInstance->UseHttps &&
!TlsConfigure &&
(AsciiStrCmp (HttpInstance->RemoteHost, HostName) == 0) &&
(!HttpInstance->UseHttps || (HttpInstance->UseHttps &&
!TlsConfigure &&
HttpInstance->TlsSessionState == EfiTlsSessionDataTransferring))) {
//
// Host Name and port number of the request URL are the same with previous call to Request().
@@ -495,7 +495,7 @@ EfiHttpRequest (
}
}
}
}
}
if (Configure) {
//
@@ -514,14 +514,14 @@ EfiHttpRequest (
Status = EFI_OUT_OF_RESOURCES;
goto Error1;
}
AsciiStrToUnicodeStrS (HostName, HostNameStr, HostNameSize);
if (!HttpInstance->LocalAddressIsIPv6) {
Status = HttpDns4 (HttpInstance, HostNameStr, &HttpInstance->RemoteAddr);
} else {
Status = HttpDns6 (HttpInstance, HostNameStr, &HttpInstance->RemoteIpv6Addr);
}
FreePool (HostNameStr);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Error: Could not retrieve the host address from DNS server.\n"));
@@ -553,10 +553,10 @@ EfiHttpRequest (
if (EFI_ERROR (Status)) {
goto Error1;
}
TlsCloseTxRxEvent (HttpInstance);
}
HttpCloseConnection (HttpInstance);
EfiHttpCancel (This, NULL);
}
@@ -575,11 +575,11 @@ EfiHttpRequest (
if (Request != NULL) {
Wrap->TcpWrap.Method = Request->Method;
}
Status = HttpInitSession (
HttpInstance,
Wrap,
Configure || ReConfigure,
HttpInstance,
Wrap,
Configure || ReConfigure,
TlsConfigure
);
if (EFI_ERROR (Status)) {
@@ -588,14 +588,14 @@ EfiHttpRequest (
if (!Configure && !ReConfigure && !TlsConfigure) {
//
// For the new HTTP token, create TX TCP token events.
// For the new HTTP token, create TX TCP token events.
//
Status = HttpCreateTcpTxEvent (Wrap);
if (EFI_ERROR (Status)) {
goto Error1;
}
}
//
// Create request message.
//
@@ -647,11 +647,11 @@ EfiHttpRequest (
RequestMsgSize
);
if (EFI_ERROR (Status)) {
goto Error5;
goto Error5;
}
DispatchDpc ();
if (HostName != NULL) {
FreePool (HostName);
}
@@ -659,7 +659,7 @@ EfiHttpRequest (
if (UrlParser != NULL) {
HttpUrlFreeParser (UrlParser);
}
return EFI_SUCCESS;
Error5:
@@ -674,7 +674,7 @@ Error5:
Error4:
if (RequestMsg != NULL) {
FreePool (RequestMsg);
}
}
Error3:
if (HttpInstance->UseHttps) {
@@ -684,7 +684,7 @@ Error3:
Error2:
HttpCloseConnection (HttpInstance);
HttpCloseTcpConnCloseEvent (HttpInstance);
if (NULL != Wrap->TcpWrap.Tx4Token.CompletionToken.Event) {
gBS->CloseEvent (Wrap->TcpWrap.Tx4Token.CompletionToken.Event);
@@ -707,12 +707,12 @@ Error1:
}
return Status;
}
/**
Cancel a user's Token.
Cancel a user's Token.
@param[in] Map The HTTP instance's token queue.
@param[in] Item Object container for one HTTP token and token's wrap.
@param[in] Context The user's token to cancel.
@@ -746,7 +746,7 @@ HttpCancelTokens (
Wrap = (HTTP_TOKEN_WRAP *) Item->Value;
ASSERT (Wrap != NULL);
HttpInstance = Wrap->HttpInstance;
if (!HttpInstance->LocalAddressIsIPv6) {
if (Wrap->TcpWrap.Rx4Token.CompletionToken.Event != NULL) {
//
@@ -781,7 +781,7 @@ HttpCancelTokens (
return EFI_ABORTED;
}
return EFI_SUCCESS;
return EFI_SUCCESS;
}
/**
@@ -794,7 +794,7 @@ HttpCancelTokens (
cancelled.
@retval EFI_SUCCESS The token is cancelled.
@retval EFI_NOT_FOUND The asynchronous request or response token is not found.
@retval EFI_NOT_FOUND The asynchronous request or response token is not found.
@retval Others Other error as indicated.
**/
@@ -814,7 +814,7 @@ HttpCancel (
if (Token != NULL) {
if (Status == EFI_ABORTED) {
return EFI_SUCCESS;
}
}
} else {
return Status;
}
@@ -843,7 +843,7 @@ HttpCancel (
HttpInstance->Tcp6->Cancel (HttpInstance->Tcp6, &HttpInstance->Tcp6TlsRxToken.CompletionToken);
}
}
return EFI_SUCCESS;
}
@@ -936,7 +936,7 @@ HttpBodyParserCallback (
} else {
Wrap->HttpInstance->NextMsg = NULL;
}
//
// Free Tx4Token or Tx6Token since already received corrsponding HTTP response.
@@ -953,7 +953,7 @@ HttpBodyParserCallback (
@retval EFI_SUCCESS Allocation succeeded.
@retval EFI_OUT_OF_RESOURCES Failed to complete the opration due to lack of resources.
@retval EFI_NOT_READY Can't find a corresponding Tx4Token/Tx6Token or
@retval EFI_NOT_READY Can't find a corresponding Tx4Token/Tx6Token or
the EFI_HTTP_UTILITIES_PROTOCOL is not available.
**/
@@ -983,7 +983,7 @@ HttpResponseWorker (
if (Wrap == NULL || Wrap->HttpInstance == NULL) {
return EFI_INVALID_PARAMETER;
}
HttpInstance = Wrap->HttpInstance;
Token = Wrap->HttpToken;
HttpMsg = Token->Message;
@@ -998,7 +998,7 @@ HttpResponseWorker (
ValueInItem = NULL;
Fragment.Len = 0;
Fragment.Bulk = NULL;
if (HttpMsg->Data.Response != NULL) {
//
// Check whether we have cached header from previous call.
@@ -1025,8 +1025,8 @@ HttpResponseWorker (
//
// Check whether we cached the whole HTTP headers.
//
EndofHeader = AsciiStrStr (HttpHeaders, HTTP_END_OF_HDR_STR);
}
EndofHeader = AsciiStrStr (HttpHeaders, HTTP_END_OF_HDR_STR);
}
HttpInstance->EndofHeader = &EndofHeader;
HttpInstance->HttpHeaders = &HttpHeaders;
@@ -1239,7 +1239,7 @@ HttpResponseWorker (
//
// We have a cached HTTP message which includes a part of HTTP header of next message.
//
BodyLen = HttpInstance->NextMsg - (HttpInstance->CacheBody + HttpInstance->CacheOffset);
BodyLen = HttpInstance->NextMsg - (HttpInstance->CacheBody + HttpInstance->CacheOffset);
} else {
BodyLen = HttpInstance->CacheLen - HttpInstance->CacheOffset;
}
@@ -1274,7 +1274,7 @@ HttpResponseWorker (
//
Status = EFI_SUCCESS;
goto Exit;
}
}
if (BodyLen == 0 && HttpInstance->MsgParser == NULL) {
//
@@ -1282,8 +1282,8 @@ HttpResponseWorker (
//
HttpMsg->BodyLength = 0;
Status = EFI_SUCCESS;
goto Exit;
}
goto Exit;
}
}
ASSERT (HttpInstance->MsgParser != NULL);
@@ -1297,7 +1297,7 @@ HttpResponseWorker (
if (EFI_ERROR (Status)) {
goto Error2;
}
} else {
if (HttpInstance->TimeoutEvent == NULL) {
//
@@ -1322,11 +1322,11 @@ HttpResponseWorker (
if (EFI_ERROR (Status)) {
goto Error2;
}
Status = HttpsReceive (HttpInstance, &Fragment, HttpInstance->TimeoutEvent);
gBS->SetTimer (HttpInstance->TimeoutEvent, TimerCancel, 0);
if (EFI_ERROR (Status)) {
goto Error2;
}
@@ -1357,19 +1357,19 @@ HttpResponseWorker (
if (HttpInstance->NextMsg != NULL) {
HttpMsg->BodyLength = MIN ((UINTN) HttpInstance->NextMsg - (UINTN) Fragment.Bulk, HttpMsg->BodyLength);
CopyMem (HttpMsg->Body, Fragment.Bulk, HttpMsg->BodyLength);
HttpInstance->CacheLen = Fragment.Len - HttpMsg->BodyLength;
if (HttpInstance->CacheLen != 0) {
if (HttpInstance->CacheBody != NULL) {
FreePool (HttpInstance->CacheBody);
}
HttpInstance->CacheBody = AllocateZeroPool (HttpInstance->CacheLen);
if (HttpInstance->CacheBody == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto Error2;
}
CopyMem (HttpInstance->CacheBody, Fragment.Bulk + HttpMsg->BodyLength, HttpInstance->CacheLen);
HttpInstance->CacheOffset = 0;
@@ -1383,7 +1383,7 @@ HttpResponseWorker (
if (HttpInstance->CacheBody != NULL) {
FreePool (HttpInstance->CacheBody);
}
HttpInstance->CacheBody = AllocateZeroPool (HttpInstance->CacheLen);
if (HttpInstance->CacheBody == NULL) {
Status = EFI_OUT_OF_RESOURCES;
@@ -1438,7 +1438,7 @@ Error:
} else {
FreePool (Wrap);
}
if (HttpHeaders != NULL) {
FreePool (HttpHeaders);
HttpHeaders = NULL;
@@ -1467,7 +1467,7 @@ Error:
gBS->SignalEvent (Token->Event);
return Status;
return Status;
}
@@ -1539,7 +1539,7 @@ EfiHttpResponse (
if (HttpMsg == NULL) {
return EFI_INVALID_PARAMETER;
}
HttpInstance = HTTP_INSTANCE_FROM_PROTOCOL (This);
if (HttpInstance->State != HTTP_STATE_TCP_CONNECTED) {
@@ -1550,7 +1550,7 @@ EfiHttpResponse (
// Check whether the token already existed.
//
if (EFI_ERROR (NetMapIterate (&HttpInstance->RxTokens, HttpTokenExist, Token))) {
return EFI_ACCESS_DENIED;
return EFI_ACCESS_DENIED;
}
Wrap = AllocateZeroPool (sizeof (HTTP_TOKEN_WRAP));
@@ -1562,8 +1562,8 @@ EfiHttpResponse (
Wrap->HttpToken = Token;
//
// Notes: For Https, receive token wrapped in HTTP_TOKEN_WRAP is not used to
// receive the https response. A special TlsRxToken is used for receiving TLS
// Notes: For Https, receive token wrapped in HTTP_TOKEN_WRAP is not used to
// receive the https response. A special TlsRxToken is used for receiving TLS
// related messages. It should be a blocking response.
//
if (!HttpInstance->UseHttps) {
@@ -1597,9 +1597,9 @@ Error:
gBS->CloseEvent (Wrap->TcpWrap.Rx6Token.CompletionToken.Event);
}
FreePool (Wrap);
}
}
return Status;
return Status;
}
/**
@@ -1640,7 +1640,7 @@ EfiHttpPoll (
if (HttpInstance->State != HTTP_STATE_TCP_CONNECTED) {
return EFI_NOT_STARTED;
}
if (HttpInstance->LocalAddressIsIPv6) {
if (HttpInstance->Tcp6 == NULL) {
return EFI_NOT_STARTED;
@@ -1652,8 +1652,8 @@ EfiHttpPoll (
}
Status = HttpInstance->Tcp4->Poll (HttpInstance->Tcp4);
}
DispatchDpc ();
return Status;
}