diff options
author | Michael Kubacki <michael.kubacki@microsoft.com> | 2021-12-05 14:54:11 -0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2021-12-07 17:24:28 +0000 |
commit | 39de741e2dcb8f11e9b4438e37224797643d8451 (patch) | |
tree | ddf957e0b215e0918dc53ad756c6bd047c9b7b16 /RedfishPkg/RedfishRestExDxe | |
parent | 5220bd211df890f2672c23c050082862cd1e82d6 (diff) | |
download | edk2-39de741e2dcb8f11e9b4438e37224797643d8451.zip edk2-39de741e2dcb8f11e9b4438e37224797643d8451.tar.gz edk2-39de741e2dcb8f11e9b4438e37224797643d8451.tar.bz2 |
RedfishPkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737
Apply uncrustify changes to .c/.h files in the RedfishPkg 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: Abner Chang <abner.chang@hpe.com>
Diffstat (limited to 'RedfishPkg/RedfishRestExDxe')
-rw-r--r-- | RedfishPkg/RedfishRestExDxe/ComponentName.c | 27 | ||||
-rw-r--r-- | RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.c | 145 | ||||
-rw-r--r-- | RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h | 115 | ||||
-rw-r--r-- | RedfishPkg/RedfishRestExDxe/RedfishRestExImpl.c | 73 | ||||
-rw-r--r-- | RedfishPkg/RedfishRestExDxe/RedfishRestExInternal.h | 68 | ||||
-rw-r--r-- | RedfishPkg/RedfishRestExDxe/RedfishRestExProtocol.c | 221 |
6 files changed, 337 insertions, 312 deletions
diff --git a/RedfishPkg/RedfishRestExDxe/ComponentName.c b/RedfishPkg/RedfishRestExDxe/ComponentName.c index 3674178..de48283 100644 --- a/RedfishPkg/RedfishRestExDxe/ComponentName.c +++ b/RedfishPkg/RedfishRestExDxe/ComponentName.c @@ -18,6 +18,7 @@ //
// EFI Component Name Functions
//
+
/**
Retrieves a Unicode string that is the user-readable name of the EFI Driver.
@@ -92,10 +93,10 @@ EFI_STATUS EFIAPI
RedfishRestExComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ IN CHAR8 *Language,
+ OUT CHAR16 **ControllerName
);
///
@@ -113,8 +114,8 @@ EFI_COMPONENT_NAME_PROTOCOL gRedfishRestExComponentName = { ///
GLOBAL_REMOVE_IF_UNREFERENCED
EFI_COMPONENT_NAME2_PROTOCOL gRedfishRestExComponentName2 = {
- (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) RedfishRestExComponentNameGetDriverName,
- (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) RedfishRestExComponentNameGetControllerName,
+ (EFI_COMPONENT_NAME2_GET_DRIVER_NAME)RedfishRestExComponentNameGetDriverName,
+ (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)RedfishRestExComponentNameGetControllerName,
"en"
};
@@ -122,12 +123,12 @@ EFI_COMPONENT_NAME2_PROTOCOL gRedfishRestExComponentName2 = { /// Table of driver names
///
GLOBAL_REMOVE_IF_UNREFERENCED
-EFI_UNICODE_STRING_TABLE mRedfishRestExDriverNameTable[] = {
+EFI_UNICODE_STRING_TABLE mRedfishRestExDriverNameTable[] = {
{ "eng;en", (CHAR16 *)L"Redfish RestEx Network Service Driver" },
- { NULL, NULL }
+ { NULL, NULL }
};
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE *gRedfishRestExControllerNameTable = NULL;
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE *gRedfishRestExControllerNameTable = NULL;
/**
Retrieves a Unicode string that is the user-readable name of the EFI Driver.
@@ -212,10 +213,10 @@ EFI_STATUS EFIAPI
RedfishRestExComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ IN CHAR8 *Language,
+ OUT CHAR16 **ControllerName
)
{
return EFI_UNSUPPORTED;
diff --git a/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.c b/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.c index 87327a8..ad65ae2 100644 --- a/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.c +++ b/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.c @@ -11,7 +11,7 @@ #include <Uefi.h>
#include "RedfishRestExDriver.h"
-EFI_DRIVER_BINDING_PROTOCOL gRedfishRestExDriverBinding = {
+EFI_DRIVER_BINDING_PROTOCOL gRedfishRestExDriverBinding = {
RedfishRestExDriverBindingSupported,
RedfishRestExDriverBindingStart,
RedfishRestExDriverBindingStop,
@@ -20,7 +20,7 @@ EFI_DRIVER_BINDING_PROTOCOL gRedfishRestExDriverBinding = { NULL
};
-EFI_SERVICE_BINDING_PROTOCOL mRedfishRestExServiceBinding = {
+EFI_SERVICE_BINDING_PROTOCOL mRedfishRestExServiceBinding = {
RedfishRestExServiceBindingCreateChild,
RedfishRestExServiceBindingDestroyChild
};
@@ -38,8 +38,8 @@ EFI_SERVICE_BINDING_PROTOCOL mRedfishRestExServiceBinding = { EFI_STATUS
EFIAPI
RestExDestroyChildEntryInHandleBuffer (
- IN LIST_ENTRY *Entry,
- IN VOID *Context
+ IN LIST_ENTRY *Entry,
+ IN VOID *Context
)
{
RESTEX_INSTANCE *Instance;
@@ -47,14 +47,14 @@ RestExDestroyChildEntryInHandleBuffer ( UINTN NumberOfChildren;
EFI_HANDLE *ChildHandleBuffer;
- if (Entry == NULL || Context == NULL) {
+ if ((Entry == NULL) || (Context == NULL)) {
return EFI_INVALID_PARAMETER;
}
- Instance = NET_LIST_USER_STRUCT_S (Entry, RESTEX_INSTANCE, Link, RESTEX_INSTANCE_SIGNATURE);
- ServiceBinding = ((RESTEX_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->ServiceBinding;
- NumberOfChildren = ((RESTEX_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->NumberOfChildren;
- ChildHandleBuffer = ((RESTEX_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->ChildHandleBuffer;
+ Instance = NET_LIST_USER_STRUCT_S (Entry, RESTEX_INSTANCE, Link, RESTEX_INSTANCE_SIGNATURE);
+ ServiceBinding = ((RESTEX_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *)Context)->ServiceBinding;
+ NumberOfChildren = ((RESTEX_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *)Context)->NumberOfChildren;
+ ChildHandleBuffer = ((RESTEX_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *)Context)->ChildHandleBuffer;
if (!NetIsInHandleBuffer (Instance->ChildHandle, NumberOfChildren, ChildHandleBuffer)) {
return EFI_SUCCESS;
@@ -71,7 +71,7 @@ RestExDestroyChildEntryInHandleBuffer ( **/
VOID
RestExDestroyInstance (
- IN RESTEX_INSTANCE *Instance
+ IN RESTEX_INSTANCE *Instance
)
{
HttpIoDestroyIo (&(Instance->HttpIo));
@@ -91,12 +91,12 @@ RestExDestroyInstance ( **/
EFI_STATUS
RestExCreateInstance (
- IN RESTEX_SERVICE *Service,
- OUT RESTEX_INSTANCE **Instance
+ IN RESTEX_SERVICE *Service,
+ OUT RESTEX_INSTANCE **Instance
)
{
- RESTEX_INSTANCE *RestExIns;
- EFI_STATUS Status;
+ RESTEX_INSTANCE *RestExIns;
+ EFI_STATUS Status;
*Instance = NULL;
Status = EFI_SUCCESS;
@@ -143,7 +143,7 @@ RestExCreateInstance ( **/
VOID
RestExDestroyService (
- IN RESTEX_SERVICE *RestExSb
+ IN RESTEX_SERVICE *RestExSb
)
{
if (RestExSb->HttpChildHandle != NULL) {
@@ -184,7 +184,7 @@ RestExDestroyService ( **/
EFI_REST_EX_SERVICE_ACCESS_MODE
RestExServiceAccessMode (
- IN EFI_HANDLE Controller
+ IN EFI_HANDLE Controller
)
{
//
@@ -213,18 +213,18 @@ RestExServiceAccessMode ( **/
EFI_STATUS
RestExCreateService (
- IN EFI_HANDLE Controller,
- IN EFI_HANDLE Image,
- OUT RESTEX_SERVICE **Service
+ IN EFI_HANDLE Controller,
+ IN EFI_HANDLE Image,
+ OUT RESTEX_SERVICE **Service
)
{
- EFI_STATUS Status;
- RESTEX_SERVICE *RestExSb;
+ EFI_STATUS Status;
+ RESTEX_SERVICE *RestExSb;
- Status = EFI_SUCCESS;
- RestExSb = NULL;
+ Status = EFI_SUCCESS;
+ RestExSb = NULL;
- *Service = NULL;
+ *Service = NULL;
RestExSb = AllocateZeroPool (sizeof (RESTEX_SERVICE));
if (RestExSb == NULL) {
@@ -241,13 +241,13 @@ RestExCreateService ( RestExSb->ControllerHandle = Controller;
RestExSb->ImageHandle = Image;
- RestExSb->RestExServiceInfo.EfiRestExServiceInfoV10.EfiRestExServiceInfoHeader.Length = sizeof (EFI_REST_EX_SERVICE_INFO);
+ RestExSb->RestExServiceInfo.EfiRestExServiceInfoV10.EfiRestExServiceInfoHeader.Length = sizeof (EFI_REST_EX_SERVICE_INFO);
RestExSb->RestExServiceInfo.EfiRestExServiceInfoV10.EfiRestExServiceInfoHeader.RestServiceInfoVer.Major = 1;
RestExSb->RestExServiceInfo.EfiRestExServiceInfoV10.EfiRestExServiceInfoHeader.RestServiceInfoVer.Minor = 0;
- RestExSb->RestExServiceInfo.EfiRestExServiceInfoV10.RestServiceType = EfiRestExServiceRedfish;
- RestExSb->RestExServiceInfo.EfiRestExServiceInfoV10.RestServiceAccessMode = RestExServiceAccessMode (Controller);
- RestExSb->RestExServiceInfo.EfiRestExServiceInfoV10.RestExConfigType = EfiRestExConfigHttp;
- RestExSb->RestExServiceInfo.EfiRestExServiceInfoV10.RestExConfigDataLength = sizeof (EFI_REST_EX_HTTP_CONFIG_DATA);
+ RestExSb->RestExServiceInfo.EfiRestExServiceInfoV10.RestServiceType = EfiRestExServiceRedfish;
+ RestExSb->RestExServiceInfo.EfiRestExServiceInfoV10.RestServiceAccessMode = RestExServiceAccessMode (Controller);
+ RestExSb->RestExServiceInfo.EfiRestExServiceInfoV10.RestExConfigType = EfiRestExConfigHttp;
+ RestExSb->RestExServiceInfo.EfiRestExServiceInfoV10.RestExConfigDataLength = sizeof (EFI_REST_EX_HTTP_CONFIG_DATA);
Status = gBS->InstallProtocolInterface (
&Controller,
@@ -354,7 +354,6 @@ RedfishRestExDriverBindingSupported ( IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
)
{
-
//
// Test for the HttpServiceBinding Protocol.
//
@@ -366,7 +365,6 @@ RedfishRestExDriverBindingSupported ( ControllerHandle,
EFI_OPEN_PROTOCOL_TEST_PROTOCOL
);
-
}
/**
@@ -412,15 +410,15 @@ RedfishRestExDriverBindingStart ( IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
)
{
- RESTEX_SERVICE *RestExSb;
- EFI_STATUS Status;
- UINT32 *Id;
- VOID *Interface;
+ RESTEX_SERVICE *RestExSb;
+ EFI_STATUS Status;
+ UINT32 *Id;
+ VOID *Interface;
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiCallerIdGuid,
- (VOID **) &Id,
+ (VOID **)&Id,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -518,12 +516,12 @@ RedfishRestExDriverBindingStop ( IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
)
{
- EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
- RESTEX_SERVICE *RestExSb;
- EFI_HANDLE NicHandle;
- EFI_STATUS Status;
- LIST_ENTRY *List;
- RESTEX_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT Context;
+ EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
+ RESTEX_SERVICE *RestExSb;
+ EFI_HANDLE NicHandle;
+ EFI_STATUS Status;
+ LIST_ENTRY *List;
+ RESTEX_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT Context;
//
// RestEx driver opens HTTP child, So, Controller is a HTTP
@@ -538,7 +536,7 @@ RedfishRestExDriverBindingStop ( Status = gBS->OpenProtocol (
NicHandle,
&gEfiRestExServiceBindingProtocolGuid,
- (VOID **) &ServiceBinding,
+ (VOID **)&ServiceBinding,
This->DriverBindingHandle,
NicHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -553,19 +551,19 @@ RedfishRestExDriverBindingStop ( //
// Destroy the RestEx child instance in ChildHandleBuffer.
//
- List = &RestExSb->RestExChildrenList;
+ List = &RestExSb->RestExChildrenList;
Context.ServiceBinding = ServiceBinding;
Context.NumberOfChildren = NumberOfChildren;
Context.ChildHandleBuffer = ChildHandleBuffer;
- Status = NetDestroyLinkList (
- List,
- RestExDestroyChildEntryInHandleBuffer,
- &Context,
- NULL
- );
+ Status = NetDestroyLinkList (
+ List,
+ RestExDestroyChildEntryInHandleBuffer,
+ &Context,
+ NULL
+ );
}
- if (NumberOfChildren == 0 && IsListEmpty (&RestExSb->RestExChildrenList)) {
+ if ((NumberOfChildren == 0) && IsListEmpty (&RestExSb->RestExChildrenList)) {
gBS->UninstallProtocolInterface (
NicHandle,
&gEfiRestExServiceBindingProtocolGuid,
@@ -611,11 +609,11 @@ RedfishRestExServiceBindingCreateChild ( IN EFI_HANDLE *ChildHandle
)
{
- RESTEX_SERVICE *RestExSb;
- RESTEX_INSTANCE *Instance;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
- VOID *Http;
+ RESTEX_SERVICE *RestExSb;
+ RESTEX_INSTANCE *Instance;
+ EFI_STATUS Status;
+ EFI_TPL OldTpl;
+ VOID *Http;
if ((This == NULL) || (ChildHandle == NULL)) {
return EFI_INVALID_PARAMETER;
@@ -627,6 +625,7 @@ RedfishRestExServiceBindingCreateChild ( if (EFI_ERROR (Status)) {
return Status;
}
+
ASSERT (Instance != NULL);
//
@@ -650,7 +649,7 @@ RedfishRestExServiceBindingCreateChild ( Status = gBS->OpenProtocol (
RestExSb->HttpChildHandle,
&gEfiHttpProtocolGuid,
- (VOID **) &Http,
+ (VOID **)&Http,
gRedfishRestExDriverBinding.DriverBindingHandle,
Instance->ChildHandle,
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
@@ -672,7 +671,7 @@ RedfishRestExServiceBindingCreateChild ( Status = gBS->OpenProtocol (
Instance->HttpIo.Handle,
&gEfiHttpProtocolGuid,
- (VOID **) &Http,
+ (VOID **)&Http,
gRedfishRestExDriverBinding.DriverBindingHandle,
Instance->ChildHandle,
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
@@ -688,12 +687,12 @@ RedfishRestExServiceBindingCreateChild ( ChildHandle
);
- gBS->UninstallMultipleProtocolInterfaces (
- Instance->ChildHandle,
- &gEfiRestExProtocolGuid,
- &Instance->RestEx,
- NULL
- );
+ gBS->UninstallMultipleProtocolInterfaces (
+ Instance->ChildHandle,
+ &gEfiRestExProtocolGuid,
+ &Instance->RestEx,
+ NULL
+ );
goto ON_ERROR;
}
@@ -741,12 +740,12 @@ RedfishRestExServiceBindingDestroyChild ( IN EFI_HANDLE ChildHandle
)
{
- RESTEX_SERVICE *RestExSb;
- RESTEX_INSTANCE *Instance;
+ RESTEX_SERVICE *RestExSb;
+ RESTEX_INSTANCE *Instance;
- EFI_REST_EX_PROTOCOL *RestEx;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
+ EFI_REST_EX_PROTOCOL *RestEx;
+ EFI_STATUS Status;
+ EFI_TPL OldTpl;
if ((This == NULL) || (ChildHandle == NULL)) {
return EFI_INVALID_PARAMETER;
@@ -758,7 +757,7 @@ RedfishRestExServiceBindingDestroyChild ( Status = gBS->OpenProtocol (
ChildHandle,
&gEfiRestExProtocolGuid,
- (VOID **) &RestEx,
+ (VOID **)&RestEx,
NULL,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -768,8 +767,8 @@ RedfishRestExServiceBindingDestroyChild ( return EFI_UNSUPPORTED;
}
- Instance = RESTEX_INSTANCE_FROM_THIS (RestEx);
- RestExSb = RESTEX_SERVICE_FROM_THIS (This);
+ Instance = RESTEX_INSTANCE_FROM_THIS (RestEx);
+ RestExSb = RESTEX_SERVICE_FROM_THIS (This);
if (Instance->Service != RestExSb) {
return EFI_INVALID_PARAMETER;
@@ -800,7 +799,6 @@ RedfishRestExServiceBindingDestroyChild ( ChildHandle
);
-
gBS->RestoreTPL (OldTpl);
//
@@ -828,4 +826,3 @@ RedfishRestExServiceBindingDestroyChild ( RestExDestroyInstance (Instance);
return EFI_SUCCESS;
}
-
diff --git a/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h b/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h index 6743ced..4a9e9f7 100644 --- a/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h +++ b/RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h @@ -45,7 +45,7 @@ extern EFI_REST_EX_PROTOCOL mRedfishRestExProtocol; ///
/// RestEx service block
///
-typedef struct _RESTEX_SERVICE RESTEX_SERVICE;
+typedef struct _RESTEX_SERVICE RESTEX_SERVICE;
///
/// RestEx instance block
@@ -57,8 +57,8 @@ typedef struct _RESTEX_INSTANCE RESTEX_INSTANCE; ///
#define REDFISH_RESTEX_DRIVER_VERSION 0x0100
-#define RESTEX_SERVICE_SIGNATURE SIGNATURE_32 ('R', 'E', 'S', 'S')
-#define RESTEX_INSTANCE_SIGNATURE SIGNATURE_32 ('R', 'E', 'I', 'S')
+#define RESTEX_SERVICE_SIGNATURE SIGNATURE_32 ('R', 'E', 'S', 'S')
+#define RESTEX_INSTANCE_SIGNATURE SIGNATURE_32 ('R', 'E', 'I', 'S')
#define RESTEX_SERVICE_FROM_THIS(a) \
CR (a, RESTEX_SERVICE, ServiceBinding, RESTEX_SERVICE_SIGNATURE)
@@ -66,59 +66,58 @@ typedef struct _RESTEX_INSTANCE RESTEX_INSTANCE; #define RESTEX_INSTANCE_FROM_THIS(a) \
CR (a, RESTEX_INSTANCE, RestEx, RESTEX_INSTANCE_SIGNATURE)
-
-#define RESTEX_STATE_UNCONFIGED 0
-#define RESTEX_STATE_CONFIGED 1
+#define RESTEX_STATE_UNCONFIGED 0
+#define RESTEX_STATE_CONFIGED 1
struct _RESTEX_SERVICE {
- UINT32 Signature;
- EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
+ UINT32 Signature;
+ EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
- UINT16 RestExChildrenNum;
- LIST_ENTRY RestExChildrenList;
+ UINT16 RestExChildrenNum;
+ LIST_ENTRY RestExChildrenList;
- EFI_HANDLE ControllerHandle;
- EFI_HANDLE ImageHandle;
+ EFI_HANDLE ControllerHandle;
+ EFI_HANDLE ImageHandle;
//
// Use to establish the parent-child relationship.
//
- EFI_HANDLE HttpChildHandle;
+ EFI_HANDLE HttpChildHandle;
- UINT32 Id;
+ UINT32 Id;
- EFI_REST_EX_SERVICE_INFO RestExServiceInfo;
+ EFI_REST_EX_SERVICE_INFO RestExServiceInfo;
};
-#define RESTEX_INSTANCE_FLAGS_TLS_RETRY 0x00000001
-#define RESTEX_INSTANCE_FLAGS_TCP_ERROR_RETRY 0x00000002
+#define RESTEX_INSTANCE_FLAGS_TLS_RETRY 0x00000001
+#define RESTEX_INSTANCE_FLAGS_TCP_ERROR_RETRY 0x00000002
struct _RESTEX_INSTANCE {
- UINT32 Signature;
- LIST_ENTRY Link;
+ UINT32 Signature;
+ LIST_ENTRY Link;
- EFI_REST_EX_PROTOCOL RestEx;
+ EFI_REST_EX_PROTOCOL RestEx;
- INTN State;
- BOOLEAN InDestroy;
+ INTN State;
+ BOOLEAN InDestroy;
- RESTEX_SERVICE *Service;
- EFI_HANDLE ChildHandle;
+ RESTEX_SERVICE *Service;
+ EFI_HANDLE ChildHandle;
- EFI_REST_EX_CONFIG_DATA ConfigData;
+ EFI_REST_EX_CONFIG_DATA ConfigData;
//
// HTTP_IO to access the HTTP service
//
- HTTP_IO HttpIo;
+ HTTP_IO HttpIo;
- UINT32 Flags;
+ UINT32 Flags;
};
typedef struct {
- EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
- UINTN NumberOfChildren;
- EFI_HANDLE *ChildHandleBuffer;
+ EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
+ UINTN NumberOfChildren;
+ EFI_HANDLE *ChildHandleBuffer;
} RESTEX_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT;
/**
@@ -143,9 +142,9 @@ typedef struct { EFI_STATUS
EFIAPI
RedfishRestExSendReceive (
- IN EFI_REST_EX_PROTOCOL *This,
- IN EFI_HTTP_MESSAGE *RequestMessage,
- OUT EFI_HTTP_MESSAGE *ResponseMessage
+ IN EFI_REST_EX_PROTOCOL *This,
+ IN EFI_HTTP_MESSAGE *RequestMessage,
+ OUT EFI_HTTP_MESSAGE *ResponseMessage
);
/**
@@ -173,8 +172,8 @@ RedfishRestExSendReceive ( EFI_STATUS
EFIAPI
RedfishRestExGetServiceTime (
- IN EFI_REST_EX_PROTOCOL *This,
- OUT EFI_TIME *Time
+ IN EFI_REST_EX_PROTOCOL *This,
+ OUT EFI_TIME *Time
);
/**
@@ -244,8 +243,8 @@ RedfishRestExGetService ( EFI_STATUS
EFIAPI
RedfishRestExGetModeData (
- IN EFI_REST_EX_PROTOCOL *This,
- OUT EFI_REST_EX_CONFIG_DATA *RestExConfigData
+ IN EFI_REST_EX_PROTOCOL *This,
+ OUT EFI_REST_EX_CONFIG_DATA *RestExConfigData
);
/**
@@ -282,8 +281,8 @@ RedfishRestExGetModeData ( EFI_STATUS
EFIAPI
RedfishRestExConfigure (
- IN EFI_REST_EX_PROTOCOL *This,
- IN EFI_REST_EX_CONFIG_DATA RestExConfigData
+ IN EFI_REST_EX_PROTOCOL *This,
+ IN EFI_REST_EX_CONFIG_DATA RestExConfigData
);
/**
@@ -320,10 +319,10 @@ RedfishRestExConfigure ( EFI_STATUS
EFIAPI
RedfishRestExAyncSendReceive (
- IN EFI_REST_EX_PROTOCOL *This,
- IN EFI_HTTP_MESSAGE *RequestMessage OPTIONAL,
- IN EFI_REST_EX_TOKEN *RestExToken,
- IN UINTN *TimeOutInMilliSeconds OPTIONAL
+ IN EFI_REST_EX_PROTOCOL *This,
+ IN EFI_HTTP_MESSAGE *RequestMessage OPTIONAL,
+ IN EFI_REST_EX_TOKEN *RestExToken,
+ IN UINTN *TimeOutInMilliSeconds OPTIONAL
);
/**
@@ -355,10 +354,11 @@ RedfishRestExAyncSendReceive ( EFI_STATUS
EFIAPI
RedfishRestExEventService (
- IN EFI_REST_EX_PROTOCOL *This,
- IN EFI_HTTP_MESSAGE *RequestMessage OPTIONAL,
- IN EFI_REST_EX_TOKEN *RestExToken
+ IN EFI_REST_EX_PROTOCOL *This,
+ IN EFI_HTTP_MESSAGE *RequestMessage OPTIONAL,
+ IN EFI_REST_EX_TOKEN *RestExToken
);
+
/**
Create a new TLS session becuase the previous on is closed.
status.
@@ -372,8 +372,7 @@ RedfishRestExEventService ( EFI_STATUS
ResetHttpTslSession (
IN RESTEX_INSTANCE *Instance
-);
-
+ );
/**
Callback function which provided by user to remove one node in NetDestroyLinkList process.
@@ -388,8 +387,8 @@ ResetHttpTslSession ( EFI_STATUS
EFIAPI
RestExDestroyChildEntryInHandleBuffer (
- IN LIST_ENTRY *Entry,
- IN VOID *Context
+ IN LIST_ENTRY *Entry,
+ IN VOID *Context
);
/**
@@ -400,7 +399,7 @@ RestExDestroyChildEntryInHandleBuffer ( **/
VOID
RestExDestroyInstance (
- IN RESTEX_INSTANCE *Instance
+ IN RESTEX_INSTANCE *Instance
);
/**
@@ -415,11 +414,10 @@ RestExDestroyInstance ( **/
EFI_STATUS
RestExCreateInstance (
- IN RESTEX_SERVICE *Service,
- OUT RESTEX_INSTANCE **Instance
+ IN RESTEX_SERVICE *Service,
+ OUT RESTEX_INSTANCE **Instance
);
-
/**
Release all the resource used the RestEx service binding instance.
@@ -428,7 +426,7 @@ RestExCreateInstance ( **/
VOID
RestExDestroyService (
- IN RESTEX_SERVICE *RestExSb
+ IN RESTEX_SERVICE *RestExSb
);
/**
@@ -446,9 +444,9 @@ RestExDestroyService ( **/
EFI_STATUS
RestExCreateService (
- IN EFI_HANDLE Controller,
- IN EFI_HANDLE Image,
- OUT RESTEX_SERVICE **Service
+ IN EFI_HANDLE Controller,
+ IN EFI_HANDLE Image,
+ OUT RESTEX_SERVICE **Service
);
/**
@@ -647,4 +645,5 @@ RedfishRestExServiceBindingDestroyChild ( IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN EFI_HANDLE ChildHandle
);
+
#endif
diff --git a/RedfishPkg/RedfishRestExDxe/RedfishRestExImpl.c b/RedfishPkg/RedfishRestExDxe/RedfishRestExImpl.c index 18d8811..eb1d8b8 100644 --- a/RedfishPkg/RedfishRestExDxe/RedfishRestExImpl.c +++ b/RedfishPkg/RedfishRestExDxe/RedfishRestExImpl.c @@ -23,9 +23,9 @@ EFI_STATUS
ResetHttpTslSession (
IN RESTEX_INSTANCE *Instance
-)
+ )
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
DEBUG ((DEBUG_INFO, "%a: TCP connection is finished. Could be TSL session closure, reset HTTP instance for the new TLS session.\n", __FUNCTION__));
@@ -34,12 +34,15 @@ ResetHttpTslSession ( DEBUG ((DEBUG_ERROR, "%a: Error to reset HTTP instance.\n", __FUNCTION__));
return Status;
}
- Status = Instance->HttpIo.Http->Configure(Instance->HttpIo.Http, &((EFI_REST_EX_HTTP_CONFIG_DATA *)Instance->ConfigData)->HttpConfigData);
+
+ Status = Instance->HttpIo.Http->Configure (Instance->HttpIo.Http, &((EFI_REST_EX_HTTP_CONFIG_DATA *)Instance->ConfigData)->HttpConfigData);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a: Error to re-initiate HTTP instance.\n", __FUNCTION__));
}
+
return Status;
}
+
/**
This function check
@@ -55,16 +58,16 @@ ResetHttpTslSession ( **/
EFI_STATUS
RedfishCheckHttpReceiveStatus (
- IN RESTEX_INSTANCE *Instance,
- IN EFI_STATUS HttpIoReceiveStatus
+ IN RESTEX_INSTANCE *Instance,
+ IN EFI_STATUS HttpIoReceiveStatus
)
{
- EFI_STATUS Status;
- EFI_STATUS ReturnStatus;
+ EFI_STATUS Status;
+ EFI_STATUS ReturnStatus;
- if (!EFI_ERROR (HttpIoReceiveStatus)){
+ if (!EFI_ERROR (HttpIoReceiveStatus)) {
ReturnStatus = EFI_SUCCESS;
- } else if (EFI_ERROR (HttpIoReceiveStatus) && HttpIoReceiveStatus != EFI_CONNECTION_FIN) {
+ } else if (EFI_ERROR (HttpIoReceiveStatus) && (HttpIoReceiveStatus != EFI_CONNECTION_FIN)) {
if ((Instance->Flags & RESTEX_INSTANCE_FLAGS_TCP_ERROR_RETRY) == 0) {
DEBUG ((DEBUG_ERROR, "%a: TCP error, reset HTTP session.\n", __FUNCTION__));
Instance->Flags |= RESTEX_INSTANCE_FLAGS_TCP_ERROR_RETRY;
@@ -80,24 +83,27 @@ RedfishCheckHttpReceiveStatus ( ReturnStatus = EFI_DEVICE_ERROR;
}
} else {
- if (HttpIoReceiveStatus == EFI_CONNECTION_FIN) {
- if ((Instance->Flags & RESTEX_INSTANCE_FLAGS_TLS_RETRY) != 0) {
- DEBUG ((DEBUG_ERROR, "%a: REST_EX Send and receive fail even with a new TLS session.\n", __FUNCTION__));
- ReturnStatus = EFI_DEVICE_ERROR;
- }
- Instance->Flags |= RESTEX_INSTANCE_FLAGS_TLS_RETRY;
- Status = ResetHttpTslSession (Instance);
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "%a: Reset HTTP instance fail.\n", __FUNCTION__));
- ReturnStatus = EFI_DEVICE_ERROR;
- }
- return EFI_NOT_READY;
+ if (HttpIoReceiveStatus == EFI_CONNECTION_FIN) {
+ if ((Instance->Flags & RESTEX_INSTANCE_FLAGS_TLS_RETRY) != 0) {
+ DEBUG ((DEBUG_ERROR, "%a: REST_EX Send and receive fail even with a new TLS session.\n", __FUNCTION__));
+ ReturnStatus = EFI_DEVICE_ERROR;
+ }
+
+ Instance->Flags |= RESTEX_INSTANCE_FLAGS_TLS_RETRY;
+ Status = ResetHttpTslSession (Instance);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: Reset HTTP instance fail.\n", __FUNCTION__));
+ ReturnStatus = EFI_DEVICE_ERROR;
}
+
+ return EFI_NOT_READY;
+ }
}
+
//
// Clean TLS new session retry and error try flags.
//
- Instance->Flags &= ~ (RESTEX_INSTANCE_FLAGS_TLS_RETRY | RESTEX_INSTANCE_FLAGS_TCP_ERROR_RETRY);
+ Instance->Flags &= ~(RESTEX_INSTANCE_FLAGS_TLS_RETRY | RESTEX_INSTANCE_FLAGS_TCP_ERROR_RETRY);
return ReturnStatus;
}
@@ -124,15 +130,15 @@ RedfishCheckHttpReceiveStatus ( **/
EFI_STATUS
RedfishHttpAddExpectation (
- IN EFI_REST_EX_PROTOCOL *This,
- IN EFI_HTTP_MESSAGE *RequestMessage,
- IN EFI_HTTP_HEADER **PreservedRequestHeaders,
- IN BOOLEAN *ItsWrite
+ IN EFI_REST_EX_PROTOCOL *This,
+ IN EFI_HTTP_MESSAGE *RequestMessage,
+ IN EFI_HTTP_HEADER **PreservedRequestHeaders,
+ IN BOOLEAN *ItsWrite
)
{
- EFI_HTTP_HEADER *NewHeaders;
+ EFI_HTTP_HEADER *NewHeaders;
- if (This == NULL || RequestMessage == NULL) {
+ if ((This == NULL) || (RequestMessage == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -142,16 +148,17 @@ RedfishHttpAddExpectation ( }
if ((RequestMessage->Data.Request->Method != HttpMethodPut) && (RequestMessage->Data.Request->Method != HttpMethodPost) &&
- (RequestMessage->Data.Request->Method != HttpMethodPatch)) {
+ (RequestMessage->Data.Request->Method != HttpMethodPatch))
+ {
return EFI_SUCCESS;
}
+
*ItsWrite = TRUE;
- NewHeaders = AllocateZeroPool((RequestMessage->HeaderCount + 1) * sizeof(EFI_HTTP_HEADER));
- CopyMem ((VOID*)NewHeaders, (VOID *)RequestMessage->Headers, RequestMessage->HeaderCount * sizeof (EFI_HTTP_HEADER));
+ NewHeaders = AllocateZeroPool ((RequestMessage->HeaderCount + 1) * sizeof (EFI_HTTP_HEADER));
+ CopyMem ((VOID *)NewHeaders, (VOID *)RequestMessage->Headers, RequestMessage->HeaderCount * sizeof (EFI_HTTP_HEADER));
HttpSetFieldNameAndValue (NewHeaders + RequestMessage->HeaderCount, HTTP_HEADER_EXPECT, HTTP_EXPECT_100_CONTINUE);
- RequestMessage->HeaderCount ++;
+ RequestMessage->HeaderCount++;
RequestMessage->Headers = NewHeaders;
return EFI_SUCCESS;
}
-
diff --git a/RedfishPkg/RedfishRestExDxe/RedfishRestExInternal.h b/RedfishPkg/RedfishRestExDxe/RedfishRestExInternal.h index b91bf39..a687c4d 100644 --- a/RedfishPkg/RedfishRestExDxe/RedfishRestExInternal.h +++ b/RedfishPkg/RedfishRestExDxe/RedfishRestExInternal.h @@ -49,8 +49,8 @@ **/
EFI_STATUS
RedfishCheckHttpReceiveStatus (
- IN RESTEX_INSTANCE *Instance,
- IN EFI_STATUS HttpIoReceiveStatus
+ IN RESTEX_INSTANCE *Instance,
+ IN EFI_STATUS HttpIoReceiveStatus
);
/**
@@ -76,10 +76,10 @@ RedfishCheckHttpReceiveStatus ( **/
EFI_STATUS
RedfishHttpAddExpectation (
- IN EFI_REST_EX_PROTOCOL *This,
- IN EFI_HTTP_MESSAGE *RequestMessage,
- IN EFI_HTTP_HEADER **PreservedRequestHeaders,
- IN BOOLEAN *ItsWrite
+ IN EFI_REST_EX_PROTOCOL *This,
+ IN EFI_HTTP_MESSAGE *RequestMessage,
+ IN EFI_HTTP_HEADER **PreservedRequestHeaders,
+ IN BOOLEAN *ItsWrite
);
/**
@@ -104,9 +104,9 @@ RedfishHttpAddExpectation ( EFI_STATUS
EFIAPI
RedfishRestExSendReceive (
- IN EFI_REST_EX_PROTOCOL *This,
- IN EFI_HTTP_MESSAGE *RequestMessage,
- OUT EFI_HTTP_MESSAGE *ResponseMessage
+ IN EFI_REST_EX_PROTOCOL *This,
+ IN EFI_HTTP_MESSAGE *RequestMessage,
+ OUT EFI_HTTP_MESSAGE *ResponseMessage
);
/**
@@ -134,8 +134,8 @@ RedfishRestExSendReceive ( EFI_STATUS
EFIAPI
RedfishRestExGetServiceTime (
- IN EFI_REST_EX_PROTOCOL *This,
- OUT EFI_TIME *Time
+ IN EFI_REST_EX_PROTOCOL *This,
+ OUT EFI_TIME *Time
);
/**
@@ -205,8 +205,8 @@ RedfishRestExGetService ( EFI_STATUS
EFIAPI
RedfishRestExGetModeData (
- IN EFI_REST_EX_PROTOCOL *This,
- OUT EFI_REST_EX_CONFIG_DATA *RestExConfigData
+ IN EFI_REST_EX_PROTOCOL *This,
+ OUT EFI_REST_EX_CONFIG_DATA *RestExConfigData
);
/**
@@ -243,8 +243,8 @@ RedfishRestExGetModeData ( EFI_STATUS
EFIAPI
RedfishRestExConfigure (
- IN EFI_REST_EX_PROTOCOL *This,
- IN EFI_REST_EX_CONFIG_DATA RestExConfigData
+ IN EFI_REST_EX_PROTOCOL *This,
+ IN EFI_REST_EX_CONFIG_DATA RestExConfigData
);
/**
@@ -281,10 +281,10 @@ RedfishRestExConfigure ( EFI_STATUS
EFIAPI
RedfishRestExAyncSendReceive (
- IN EFI_REST_EX_PROTOCOL *This,
- IN EFI_HTTP_MESSAGE *RequestMessage OPTIONAL,
- IN EFI_REST_EX_TOKEN *RestExToken,
- IN UINTN *TimeOutInMilliSeconds OPTIONAL
+ IN EFI_REST_EX_PROTOCOL *This,
+ IN EFI_HTTP_MESSAGE *RequestMessage OPTIONAL,
+ IN EFI_REST_EX_TOKEN *RestExToken,
+ IN UINTN *TimeOutInMilliSeconds OPTIONAL
);
/**
@@ -316,10 +316,11 @@ RedfishRestExAyncSendReceive ( EFI_STATUS
EFIAPI
RedfishRestExEventService (
- IN EFI_REST_EX_PROTOCOL *This,
- IN EFI_HTTP_MESSAGE *RequestMessage OPTIONAL,
- IN EFI_REST_EX_TOKEN *RestExToken
+ IN EFI_REST_EX_PROTOCOL *This,
+ IN EFI_HTTP_MESSAGE *RequestMessage OPTIONAL,
+ IN EFI_REST_EX_TOKEN *RestExToken
);
+
/**
Create a new TLS session becuase the previous on is closed.
status.
@@ -333,8 +334,7 @@ RedfishRestExEventService ( EFI_STATUS
ResetHttpTslSession (
IN RESTEX_INSTANCE *Instance
-);
-
+ );
/**
Callback function which provided by user to remove one node in NetDestroyLinkList process.
@@ -349,8 +349,8 @@ ResetHttpTslSession ( EFI_STATUS
EFIAPI
RestExDestroyChildEntryInHandleBuffer (
- IN LIST_ENTRY *Entry,
- IN VOID *Context
+ IN LIST_ENTRY *Entry,
+ IN VOID *Context
);
/**
@@ -361,7 +361,7 @@ RestExDestroyChildEntryInHandleBuffer ( **/
VOID
RestExDestroyInstance (
- IN RESTEX_INSTANCE *Instance
+ IN RESTEX_INSTANCE *Instance
);
/**
@@ -376,11 +376,10 @@ RestExDestroyInstance ( **/
EFI_STATUS
RestExCreateInstance (
- IN RESTEX_SERVICE *Service,
- OUT RESTEX_INSTANCE **Instance
+ IN RESTEX_SERVICE *Service,
+ OUT RESTEX_INSTANCE **Instance
);
-
/**
Release all the resource used the RestEx service binding instance.
@@ -389,7 +388,7 @@ RestExCreateInstance ( **/
VOID
RestExDestroyService (
- IN RESTEX_SERVICE *RestExSb
+ IN RESTEX_SERVICE *RestExSb
);
/**
@@ -407,9 +406,9 @@ RestExDestroyService ( **/
EFI_STATUS
RestExCreateService (
- IN EFI_HANDLE Controller,
- IN EFI_HANDLE Image,
- OUT RESTEX_SERVICE **Service
+ IN EFI_HANDLE Controller,
+ IN EFI_HANDLE Image,
+ OUT RESTEX_SERVICE **Service
);
/**
@@ -608,4 +607,5 @@ RedfishRestExServiceBindingDestroyChild ( IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN EFI_HANDLE ChildHandle
);
+
#endif
diff --git a/RedfishPkg/RedfishRestExDxe/RedfishRestExProtocol.c b/RedfishPkg/RedfishRestExDxe/RedfishRestExProtocol.c index 65a5fe3..f224104 100644 --- a/RedfishPkg/RedfishRestExDxe/RedfishRestExProtocol.c +++ b/RedfishPkg/RedfishRestExDxe/RedfishRestExProtocol.c @@ -45,37 +45,37 @@ EFI_REST_EX_PROTOCOL mRedfishRestExProtocol = { EFI_STATUS
EFIAPI
RedfishRestExSendReceive (
- IN EFI_REST_EX_PROTOCOL *This,
- IN EFI_HTTP_MESSAGE *RequestMessage,
- OUT EFI_HTTP_MESSAGE *ResponseMessage
+ IN EFI_REST_EX_PROTOCOL *This,
+ IN EFI_HTTP_MESSAGE *RequestMessage,
+ OUT EFI_HTTP_MESSAGE *ResponseMessage
)
{
- EFI_STATUS Status;
- RESTEX_INSTANCE *Instance;
- HTTP_IO_RESPONSE_DATA *ResponseData;
- UINTN TotalReceivedSize;
- UINTN Index;
- LIST_ENTRY *ChunkListLink;
- HTTP_IO_CHUNKS *ThisChunk;
- BOOLEAN CopyChunkData;
- BOOLEAN MediaPresent;
- EFI_HTTP_HEADER *PreservedRequestHeaders;
- BOOLEAN ItsWrite;
- BOOLEAN IsGetChunkedTransfer;
- HTTP_IO_SEND_CHUNK_PROCESS SendChunkProcess;
- HTTP_IO_SEND_NON_CHUNK_PROCESS SendNonChunkProcess;
- EFI_HTTP_MESSAGE ChunkTransferRequestMessage;
-
- Status = EFI_SUCCESS;
- ResponseData = NULL;
+ EFI_STATUS Status;
+ RESTEX_INSTANCE *Instance;
+ HTTP_IO_RESPONSE_DATA *ResponseData;
+ UINTN TotalReceivedSize;
+ UINTN Index;
+ LIST_ENTRY *ChunkListLink;
+ HTTP_IO_CHUNKS *ThisChunk;
+ BOOLEAN CopyChunkData;
+ BOOLEAN MediaPresent;
+ EFI_HTTP_HEADER *PreservedRequestHeaders;
+ BOOLEAN ItsWrite;
+ BOOLEAN IsGetChunkedTransfer;
+ HTTP_IO_SEND_CHUNK_PROCESS SendChunkProcess;
+ HTTP_IO_SEND_NON_CHUNK_PROCESS SendNonChunkProcess;
+ EFI_HTTP_MESSAGE ChunkTransferRequestMessage;
+
+ Status = EFI_SUCCESS;
+ ResponseData = NULL;
IsGetChunkedTransfer = FALSE;
- SendChunkProcess = HttpIoSendChunkNone;
- SendNonChunkProcess = HttpIoSendNonChunkNone;
+ SendChunkProcess = HttpIoSendChunkNone;
+ SendNonChunkProcess = HttpIoSendNonChunkNone;
//
// Validate the parameters
//
- if ((This == NULL) || (RequestMessage == NULL) || ResponseMessage == NULL) {
+ if ((This == NULL) || (RequestMessage == NULL) || (ResponseMessage == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -101,17 +101,19 @@ RedfishRestExSendReceive ( if (EFI_ERROR (Status)) {
return Status;
}
+
if (ItsWrite == TRUE) {
if (RequestMessage->BodyLength > HTTP_IO_MAX_SEND_PAYLOAD) {
//
// Send chunked transfer.
//
- SendChunkProcess ++;
+ SendChunkProcess++;
CopyMem ((VOID *)&ChunkTransferRequestMessage, (VOID *)RequestMessage, sizeof (EFI_HTTP_MESSAGE));
} else {
- SendNonChunkProcess ++;
+ SendNonChunkProcess++;
}
}
+
ReSendRequest:;
//
// Send out the request to REST service.
@@ -127,7 +129,7 @@ ReSendRequest:; // following request message body using chunk transfer.
//
do {
- Status = HttpIoSendChunkedTransfer(
+ Status = HttpIoSendChunkedTransfer (
&(Instance->HttpIo),
&SendChunkProcess,
&ChunkTransferRequestMessage
@@ -141,20 +143,20 @@ ReSendRequest:; // This is the non-chunk transfer, send request header first and then
// handle the following request message body using chunk transfer.
//
- Status = HttpIoSendRequest(
+ Status = HttpIoSendRequest (
&(Instance->HttpIo),
- (SendNonChunkProcess == HttpIoSendNonChunkContent)? NULL: RequestMessage->Data.Request,
- (SendNonChunkProcess == HttpIoSendNonChunkContent)? 0: RequestMessage->HeaderCount,
- (SendNonChunkProcess == HttpIoSendNonChunkContent)? NULL: RequestMessage->Headers,
- (SendNonChunkProcess == HttpIoSendNonChunkHeaderZeroContent)? 0: RequestMessage->BodyLength,
- (SendNonChunkProcess == HttpIoSendNonChunkHeaderZeroContent)? NULL: RequestMessage->Body
+ (SendNonChunkProcess == HttpIoSendNonChunkContent) ? NULL : RequestMessage->Data.Request,
+ (SendNonChunkProcess == HttpIoSendNonChunkContent) ? 0 : RequestMessage->HeaderCount,
+ (SendNonChunkProcess == HttpIoSendNonChunkContent) ? NULL : RequestMessage->Headers,
+ (SendNonChunkProcess == HttpIoSendNonChunkHeaderZeroContent) ? 0 : RequestMessage->BodyLength,
+ (SendNonChunkProcess == HttpIoSendNonChunkHeaderZeroContent) ? NULL : RequestMessage->Body
);
}
} else {
//
// This is read from URI.
//
- Status = HttpIoSendRequest(
+ Status = HttpIoSendRequest (
&(Instance->HttpIo),
RequestMessage->Data.Request,
RequestMessage->HeaderCount,
@@ -163,6 +165,7 @@ ReSendRequest:; RequestMessage->Body
);
}
+
if (EFI_ERROR (Status)) {
goto ON_EXIT;
}
@@ -173,20 +176,20 @@ ReSendRequest:; // Clean the previous buffers and all of them will be allocated later according to the actual situation.
//
if (ResponseMessage->Data.Response != NULL) {
- FreePool(ResponseMessage->Data.Response);
+ FreePool (ResponseMessage->Data.Response);
ResponseMessage->Data.Response = NULL;
}
ResponseMessage->BodyLength = 0;
if (ResponseMessage->Body != NULL) {
- FreePool(ResponseMessage->Body);
+ FreePool (ResponseMessage->Body);
ResponseMessage->Body = NULL;
}
//
// Use zero BodyLength to only receive the response headers.
//
- ResponseData = AllocateZeroPool (sizeof(HTTP_IO_RESPONSE_DATA));
+ ResponseData = AllocateZeroPool (sizeof (HTTP_IO_RESPONSE_DATA));
if (ResponseData == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto ON_EXIT;
@@ -194,25 +197,26 @@ ReSendRequest:; DEBUG ((DEBUG_INFO, "Receiving HTTP response and headers...\n"));
Status = RedfishCheckHttpReceiveStatus (
- Instance,
- HttpIoRecvResponse (
- &(Instance->HttpIo),
- TRUE,
- ResponseData
- )
+ Instance,
+ HttpIoRecvResponse (
+ &(Instance->HttpIo),
+ TRUE,
+ ResponseData
+ )
);
if (Status == EFI_NOT_READY) {
- goto ReSendRequest;
+ goto ReSendRequest;
} else if (Status == EFI_DEVICE_ERROR) {
goto ON_EXIT;
}
+
//
// Restore the headers if it ever changed in RedfishHttpAddExpectation().
//
if (RequestMessage->Headers != PreservedRequestHeaders) {
FreePool (RequestMessage->Headers);
RequestMessage->Headers = PreservedRequestHeaders; // Restore headers before we adding "Expect".
- RequestMessage->HeaderCount --; // Minus one header count for "Expect".
+ RequestMessage->HeaderCount--; // Minus one header count for "Expect".
}
DEBUG ((DEBUG_INFO, "HTTP Response StatusCode - %d:", ResponseData->Response.StatusCode));
@@ -221,7 +225,7 @@ ReSendRequest:; if (SendChunkProcess == HttpIoSendChunkHeaderZeroContent) {
DEBUG ((DEBUG_INFO, "This is chunk transfer, start to send all chunks.", ResponseData->Response.StatusCode));
- SendChunkProcess ++;
+ SendChunkProcess++;
goto ReSendRequest;
}
} else if (ResponseData->Response.StatusCode == HTTP_STATUS_413_REQUEST_ENTITY_TOO_LARGE) {
@@ -229,7 +233,7 @@ ReSendRequest:; Status = EFI_BAD_BUFFER_SIZE;
goto ON_EXIT;
- } else if (ResponseData->Response.StatusCode == HTTP_STATUS_405_METHOD_NOT_ALLOWED){
+ } else if (ResponseData->Response.StatusCode == HTTP_STATUS_405_METHOD_NOT_ALLOWED) {
DEBUG ((DEBUG_ERROR, "HTTP_STATUS_405_METHOD_NOT_ALLOWED\n"));
Status = EFI_ACCESS_DENIED;
@@ -238,7 +242,7 @@ ReSendRequest:; DEBUG ((DEBUG_INFO, "HTTP_STATUS_400_BAD_REQUEST\n"));
if (SendChunkProcess == HttpIoSendChunkHeaderZeroContent) {
DEBUG ((DEBUG_INFO, "Bad request may caused by zero length chunk. Try to send all chunks...\n"));
- SendChunkProcess ++;
+ SendChunkProcess++;
goto ReSendRequest;
}
} else if (ResponseData->Response.StatusCode == HTTP_STATUS_100_CONTINUE) {
@@ -248,22 +252,25 @@ ReSendRequest:; // We get HTTP_STATUS_100_CONTINUE to send the body using chunk transfer.
//
DEBUG ((DEBUG_INFO, "HTTP_STATUS_100_CONTINUE for chunk transfer...\n"));
- SendChunkProcess ++;
+ SendChunkProcess++;
goto ReSendRequest;
}
+
if (SendNonChunkProcess == HttpIoSendNonChunkHeaderZeroContent) {
DEBUG ((DEBUG_INFO, "HTTP_STATUS_100_CONTINUE for non chunk transfer...\n"));
- SendNonChunkProcess ++;
+ SendNonChunkProcess++;
goto ReSendRequest;
}
+
//
// It's the REST protocol's responsibility to handle the interim HTTP response (e.g. 100 Continue Informational),
// and return the final response content to the caller.
//
- if (ResponseData->Headers != NULL && ResponseData->HeaderCount != 0) {
+ if ((ResponseData->Headers != NULL) && (ResponseData->HeaderCount != 0)) {
FreePool (ResponseData->Headers);
}
- ZeroMem (ResponseData, sizeof(HTTP_IO_RESPONSE_DATA));
+
+ ZeroMem (ResponseData, sizeof (HTTP_IO_RESPONSE_DATA));
Status = HttpIoRecvResponse (
&(Instance->HttpIo),
TRUE,
@@ -288,15 +295,15 @@ ReSendRequest:; }
ResponseMessage->Data.Response->StatusCode = ResponseData->Response.StatusCode;
- ResponseMessage->HeaderCount = ResponseData->HeaderCount;
- ResponseMessage->Headers = ResponseData->Headers;
+ ResponseMessage->HeaderCount = ResponseData->HeaderCount;
+ ResponseMessage->Headers = ResponseData->Headers;
//
// Get response message body.
//
if (ResponseMessage->HeaderCount > 0) {
Status = HttpIoGetContentLength (ResponseMessage->HeaderCount, ResponseMessage->Headers, &ResponseMessage->BodyLength);
- if (EFI_ERROR (Status) && Status != EFI_NOT_FOUND) {
+ if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
goto ON_EXIT;
}
@@ -315,46 +322,52 @@ ReSendRequest:; &ChunkListLink,
&ResponseMessage->BodyLength
);
- if (EFI_ERROR (Status) && Status != EFI_NOT_FOUND) {
+ if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
goto ON_EXIT;
}
- if (Status == EFI_SUCCESS &&
- ChunkListLink != NULL &&
- !IsListEmpty(ChunkListLink) &&
- ResponseMessage->BodyLength != 0) {
+
+ if ((Status == EFI_SUCCESS) &&
+ (ChunkListLink != NULL) &&
+ !IsListEmpty (ChunkListLink) &&
+ (ResponseMessage->BodyLength != 0))
+ {
IsGetChunkedTransfer = TRUE;
//
// Copy data to Message body.
//
- CopyChunkData = TRUE;
+ CopyChunkData = TRUE;
ResponseMessage->Body = AllocateZeroPool (ResponseMessage->BodyLength);
if (ResponseMessage->Body == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
+ Status = EFI_OUT_OF_RESOURCES;
CopyChunkData = FALSE;
}
+
Index = 0;
- while (!IsListEmpty(ChunkListLink)) {
+ while (!IsListEmpty (ChunkListLink)) {
ThisChunk = (HTTP_IO_CHUNKS *)GetFirstNode (ChunkListLink);
if (CopyChunkData) {
- CopyMem(((UINT8 *)ResponseMessage->Body + Index), (UINT8 *)ThisChunk->Data, ThisChunk->Length);
+ CopyMem (((UINT8 *)ResponseMessage->Body + Index), (UINT8 *)ThisChunk->Data, ThisChunk->Length);
Index += ThisChunk->Length;
}
+
RemoveEntryList (&ThisChunk->NextChunk);
FreePool ((VOID *)ThisChunk->Data);
FreePool ((VOID *)ThisChunk);
- };
+ }
+
FreePool ((VOID *)ChunkListLink);
}
}
+
Status = EFI_SUCCESS;
}
//
// Ready to return the Body from REST service if have any.
//
- if (ResponseMessage->BodyLength > 0 && !IsGetChunkedTransfer) {
+ if ((ResponseMessage->BodyLength > 0) && !IsGetChunkedTransfer) {
ResponseData->HeaderCount = 0;
- ResponseData->Headers = NULL;
+ ResponseData->Headers = NULL;
ResponseMessage->Body = AllocateZeroPool (ResponseMessage->BodyLength);
if (ResponseMessage->Body == NULL) {
@@ -368,20 +381,22 @@ ReSendRequest:; TotalReceivedSize = 0;
while (TotalReceivedSize < ResponseMessage->BodyLength) {
ResponseData->BodyLength = ResponseMessage->BodyLength - TotalReceivedSize;
- ResponseData->Body = (CHAR8 *) ResponseMessage->Body + TotalReceivedSize;
- Status = HttpIoRecvResponse (
- &(Instance->HttpIo),
- FALSE,
- ResponseData
- );
+ ResponseData->Body = (CHAR8 *)ResponseMessage->Body + TotalReceivedSize;
+ Status = HttpIoRecvResponse (
+ &(Instance->HttpIo),
+ FALSE,
+ ResponseData
+ );
if (EFI_ERROR (Status)) {
goto ON_EXIT;
}
TotalReceivedSize += ResponseData->BodyLength;
}
+
DEBUG ((DEBUG_INFO, "Total of lengh of Response :%d\n", TotalReceivedSize));
}
+
DEBUG ((DEBUG_INFO, "RedfishRestExSendReceive()- EFI_STATUS: %r\n", Status));
ON_EXIT:
@@ -401,6 +416,7 @@ ON_EXIT: ResponseMessage->Body = NULL;
}
}
+
return Status;
}
@@ -429,8 +445,8 @@ ON_EXIT: EFI_STATUS
EFIAPI
RedfishRestExGetServiceTime (
- IN EFI_REST_EX_PROTOCOL *This,
- OUT EFI_TIME *Time
+ IN EFI_REST_EX_PROTOCOL *This,
+ OUT EFI_TIME *Time
)
{
return EFI_UNSUPPORTED;
@@ -474,17 +490,17 @@ RedfishRestExGetService ( OUT EFI_REST_EX_SERVICE_INFO **RestExServiceInfo
)
{
- EFI_TPL OldTpl;
- RESTEX_INSTANCE *Instance;
- EFI_REST_EX_SERVICE_INFO *ServiceInfo;
+ EFI_TPL OldTpl;
+ RESTEX_INSTANCE *Instance;
+ EFI_REST_EX_SERVICE_INFO *ServiceInfo;
ServiceInfo = NULL;
- if (This == NULL || RestExServiceInfo == NULL) {
+ if ((This == NULL) || (RestExServiceInfo == NULL)) {
return EFI_INVALID_PARAMETER;
}
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
+ OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
Instance = RESTEX_INSTANCE_FROM_THIS (This);
@@ -531,8 +547,8 @@ RedfishRestExGetService ( EFI_STATUS
EFIAPI
RedfishRestExGetModeData (
- IN EFI_REST_EX_PROTOCOL *This,
- OUT EFI_REST_EX_CONFIG_DATA *RestExConfigData
+ IN EFI_REST_EX_PROTOCOL *This,
+ OUT EFI_REST_EX_CONFIG_DATA *RestExConfigData
)
{
return EFI_UNSUPPORTED;
@@ -572,15 +588,15 @@ RedfishRestExGetModeData ( EFI_STATUS
EFIAPI
RedfishRestExConfigure (
- IN EFI_REST_EX_PROTOCOL *This,
- IN EFI_REST_EX_CONFIG_DATA RestExConfigData
+ IN EFI_REST_EX_PROTOCOL *This,
+ IN EFI_REST_EX_CONFIG_DATA RestExConfigData
)
{
- EFI_STATUS Status;
- EFI_TPL OldTpl;
- RESTEX_INSTANCE *Instance;
+ EFI_STATUS Status;
+ EFI_TPL OldTpl;
+ RESTEX_INSTANCE *Instance;
- EFI_HTTP_CONFIG_DATA *HttpConfigData;
+ EFI_HTTP_CONFIG_DATA *HttpConfigData;
Status = EFI_SUCCESS;
HttpConfigData = NULL;
@@ -589,7 +605,7 @@ RedfishRestExConfigure ( return EFI_INVALID_PARAMETER;
}
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
+ OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
Instance = RESTEX_INSTANCE_FROM_THIS (This);
@@ -601,19 +617,21 @@ RedfishRestExConfigure ( if (Instance->ConfigData != NULL) {
if (((EFI_REST_EX_HTTP_CONFIG_DATA *)Instance->ConfigData)->HttpConfigData.AccessPoint.IPv4Node != NULL) {
- FreePool(((EFI_REST_EX_HTTP_CONFIG_DATA *)Instance->ConfigData)->HttpConfigData.AccessPoint.IPv4Node);
+ FreePool (((EFI_REST_EX_HTTP_CONFIG_DATA *)Instance->ConfigData)->HttpConfigData.AccessPoint.IPv4Node);
}
- FreePool(Instance->ConfigData);
+
+ FreePool (Instance->ConfigData);
Instance->ConfigData = NULL;
}
Instance->State = RESTEX_STATE_UNCONFIGED;
} else {
HttpConfigData = &((EFI_REST_EX_HTTP_CONFIG_DATA *)RestExConfigData)->HttpConfigData;
- Status = Instance->HttpIo.Http->Configure (Instance->HttpIo.Http, HttpConfigData);
+ Status = Instance->HttpIo.Http->Configure (Instance->HttpIo.Http, HttpConfigData);
if (EFI_ERROR (Status)) {
goto ON_EXIT;
}
+
Instance->HttpIo.Timeout = ((EFI_REST_EX_HTTP_CONFIG_DATA *)RestExConfigData)->SendReceiveTimeout;
Instance->ConfigData = AllocateZeroPool (sizeof (EFI_REST_EX_HTTP_CONFIG_DATA));
@@ -621,6 +639,7 @@ RedfishRestExConfigure ( Status = EFI_OUT_OF_RESOURCES;
goto ON_EXIT;
}
+
CopyMem (Instance->ConfigData, RestExConfigData, sizeof (EFI_REST_EX_HTTP_CONFIG_DATA));
if (HttpConfigData->LocalAddressIsIPv6 == TRUE) {
((EFI_REST_EX_HTTP_CONFIG_DATA *)Instance->ConfigData)->HttpConfigData.AccessPoint.IPv6Node = AllocateZeroPool (sizeof (EFI_HTTPv6_ACCESS_POINT));
@@ -628,6 +647,7 @@ RedfishRestExConfigure ( Status = EFI_OUT_OF_RESOURCES;
goto ON_EXIT;
}
+
CopyMem (
((EFI_REST_EX_HTTP_CONFIG_DATA *)Instance->ConfigData)->HttpConfigData.AccessPoint.IPv6Node,
HttpConfigData->AccessPoint.IPv6Node,
@@ -639,12 +659,14 @@ RedfishRestExConfigure ( Status = EFI_OUT_OF_RESOURCES;
goto ON_EXIT;
}
+
CopyMem (
((EFI_REST_EX_HTTP_CONFIG_DATA *)Instance->ConfigData)->HttpConfigData.AccessPoint.IPv4Node,
HttpConfigData->AccessPoint.IPv4Node,
sizeof (EFI_HTTPv4_ACCESS_POINT)
);
}
+
Instance->State = RESTEX_STATE_CONFIGED;
}
@@ -687,10 +709,10 @@ ON_EXIT: EFI_STATUS
EFIAPI
RedfishRestExAyncSendReceive (
- IN EFI_REST_EX_PROTOCOL *This,
- IN EFI_HTTP_MESSAGE *RequestMessage OPTIONAL,
- IN EFI_REST_EX_TOKEN *RestExToken,
- IN UINTN *TimeOutInMilliSeconds OPTIONAL
+ IN EFI_REST_EX_PROTOCOL *This,
+ IN EFI_HTTP_MESSAGE *RequestMessage OPTIONAL,
+ IN EFI_REST_EX_TOKEN *RestExToken,
+ IN UINTN *TimeOutInMilliSeconds OPTIONAL
)
{
return EFI_UNSUPPORTED;
@@ -725,11 +747,10 @@ RedfishRestExAyncSendReceive ( EFI_STATUS
EFIAPI
RedfishRestExEventService (
- IN EFI_REST_EX_PROTOCOL *This,
- IN EFI_HTTP_MESSAGE *RequestMessage OPTIONAL,
- IN EFI_REST_EX_TOKEN *RestExToken
+ IN EFI_REST_EX_PROTOCOL *This,
+ IN EFI_HTTP_MESSAGE *RequestMessage OPTIONAL,
+ IN EFI_REST_EX_TOKEN *RestExToken
)
{
return EFI_UNSUPPORTED;
}
-
|