Skip to content

Commit

Permalink
RedfishClientPkg/RedfishProtocolFeaturesLib: library to get protocol …
Browse files Browse the repository at this point in the history
…feature

Add new library to read Redfish protocol feature attribute. Redfish
feature driver calls this library to get protocol feature support
on BMC.

Signed-off-by: Nickle Wang <[email protected]>
  • Loading branch information
nicklela committed Oct 24, 2024
1 parent 8c468ea commit d661619
Show file tree
Hide file tree
Showing 5 changed files with 478 additions and 0 deletions.
87 changes: 87 additions & 0 deletions RedfishClientPkg/Include/Library/RedfishProtocolFeaturesLib.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/** @file
This file defines the Redfish protocol features Library interface.
Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/

#ifndef REDFISH_PROTOCOL_FEATURES_LIB_H_
#define REDFISH_PROTOCOL_FEATURES_LIB_H_

//
// Redfish HTTP query parameter definition.
//
#define REDFISH_EXPAND_PARAMETER L"?$expand=."

///
/// Definitions of REDFISH_DEEP_OPERATIONS
///
typedef struct {
BOOLEAN DeepPATCH;
BOOLEAN DeepPOST;
UINTN MaxLevels;
} REDFISH_DEEP_OPERATIONS;

///
/// Definitions of REDFISH_EXPAND
///
typedef struct {
BOOLEAN ExpandAll;
BOOLEAN Levels;
BOOLEAN Links;
UINTN MaxLevels;
BOOLEAN NoLinks;
} REDFISH_EXPAND;

///
/// Definitions of REDFISH_PROTOCOL_FEATURES_SUPPORT
///
typedef struct {
REDFISH_DEEP_OPERATIONS DeepOperations;
BOOLEAN ExcerptQuery;
REDFISH_EXPAND ExpandQuery;
BOOLEAN FilterQuery;
BOOLEAN MultipleHTTPRequests;
BOOLEAN OnlyMemberQuery;
BOOLEAN SelectQuery;
} REDFISH_PROTOCOL_FEATURES_SUPPORT;

/**
This function query service root at BMC to get ProtocolFeaturesSupported
attribute and return the data in REDFISH_PROTOCOL_FEATURES_SUPPORT
structure.
@param[in] Service Redfish service instance
@param[out] ProtocolFeaturesSupported Protocol features supported data on return.
@retval EFI_SUCCESS Protocol feature data is returned successfully.
@retval Others Error occurs.
**/
EFI_STATUS
EFIAPI
RedfishGetProtocolFeatures (
IN REDFISH_SERVICE Service,
OUT REDFISH_PROTOCOL_FEATURES_SUPPORT *ProtocolFeaturesSupported
);

/**
This function query service root at BMC to get ProtocolFeaturesSupported
attribute and returns "NoLinks" attribute value.
If the use of expand parameter is disabled by PcdHttpExpandQueryDisabled,
this function always return FALSE no matter Redfish service supports it or not.
@param[in] Service Redfish service instance
@retval TRUE "NoLinks" is TRUE and PcdHttpExpandQueryDisabled is FALSE.
@retval FALSe "NoLinks" is FALSE or PcdHttpExpandQueryDisabled is TRUE.
**/
BOOLEAN
RedfishNoLinksSupported (
IN REDFISH_SERVICE Service
);

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/** @file
Redfish Protocol Features library internal header file.
Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/

#ifndef REDFISH_PROTOCOL_FEATURES_INTERNAL_H_
#define REDFISH_PROTOCOL_FEATURES_INTERNAL_H_

#include <Uefi.h>
#include <RedfishBase.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/JsonLib.h>
#include <Library/PcdLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/RedfishHttpLib.h>
#include <Library/RedfishVersionLib.h>
#include <Library/RedfishDebugLib.h>
#include <Library/RedfishProtocolFeaturesLib.h>

#define REDFISH_PROTOCOL_FEATURES_DEBUG DEBUG_MANAGEABILITY
//
// Attributes defined in #ServiceRoot.v1_16_0.ServiceRoot
//
#define REDFISH_ATTRIBUTE_PROTOCOL_FEATURES_SUPPORTED "ProtocolFeaturesSupported"
#define REDFISH_ATTRIBUTE_DEEP_OPERATIONS "DeepOperations"
#define REDFISH_ATTRIBUTE_EXCERPT_QUERY "ExcerptQuery"
#define REDFISH_ATTRIBUTE_EXPAND_QUERY "ExpandQuery"
#define REDFISH_ATTRIBUTE_FILTER_QUERY "FilterQuery"
#define REDFISH_ATTRIBUTE_MULTIPLE_HTTP_REQUESTS "MultipleHTTPRequests"
#define REDFISH_ATTRIBUTE_ONLY_MEMBER_QUERY "OnlyMemberQuery"
#define REDFISH_ATTRIBUTE_SELECT_QUERY "SelectQuery"
#define REDFISH_ATTRIBUTE_DEEP_PATCH "DeepPATCH"
#define REDFISH_ATTRIBUTE_DEEP_POST "DeepPOST"
#define REDFISH_ATTRIBUTE_MAX_LEVELS "MaxLevels"
#define REDFISH_ATTRIBUTE_EXPAND_ALL "ExpandAll"
#define REDFISH_ATTRIBUTE_LEVELS "Levels"
#define REDFISH_ATTRIBUTE_LINKS "Links"
#define REDFISH_ATTRIBUTE_NO_LINKS "NoLinks"

#endif
Loading

0 comments on commit d661619

Please sign in to comment.