summaryrefslogtreecommitdiff
path: root/RedfishPkg/Include
diff options
context:
space:
mode:
authorNickle Wang <nicklew@nvidia.com>2023-03-01 16:44:57 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-03-06 03:20:58 +0000
commit5a0932b7d480c05761a3ba9b5cf1d2fbb470c615 (patch)
tree0bca3c852d1c60b555cf4978517a1a1d8c484054 /RedfishPkg/Include
parentfc14c809cb982f3c8cb3429604262cde0cb264a9 (diff)
downloadedk2-5a0932b7d480c05761a3ba9b5cf1d2fbb470c615.zip
edk2-5a0932b7d480c05761a3ba9b5cf1d2fbb470c615.tar.gz
edk2-5a0932b7d480c05761a3ba9b5cf1d2fbb470c615.tar.bz2
RedfishPkg/RedfishDebugLib: provide Redfish debug
Introduce RedfishDebugLib to RedfishPkg. This library provides several debugging functions for Redfish application. Redfish drivers rely on Rest Ex protocol to communicate with BMC and the communication data may be big and complicated. Use RedfishDebugLib in RedfishRestExDxe to simplify debugging process. Signed-off-by: Nickle Wang <nicklew@nvidia.com> Cc: Abner Chang <abner.chang@amd.com> Cc: Igor Kulchytskyy <igork@ami.com> Cc: Nick Ramirez <nramirez@nvidia.com> Reviewed-by: Abner Chang <abner.chang@amd.com>
Diffstat (limited to 'RedfishPkg/Include')
-rw-r--r--RedfishPkg/Include/Library/RedfishDebugLib.h90
1 files changed, 90 insertions, 0 deletions
diff --git a/RedfishPkg/Include/Library/RedfishDebugLib.h b/RedfishPkg/Include/Library/RedfishDebugLib.h
new file mode 100644
index 0000000..21f0135
--- /dev/null
+++ b/RedfishPkg/Include/Library/RedfishDebugLib.h
@@ -0,0 +1,90 @@
+/** @file
+ This file defines the Redfish debug library interface.
+
+ Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef REDFISH_DEBUG_LIB_H_
+#define REDFISH_DEBUG_LIB_H_
+
+#include <Uefi.h>
+#include <Library/JsonLib.h>
+#include <Library/RedfishLib.h>
+
+#define DEBUG_REDFISH_NETWORK DEBUG_INFO ///< Debug error level for Redfish networking function
+
+/**
+
+ This function dump the Json string in given error level.
+
+ @param[in] ErrorLevel DEBUG macro error level
+ @param[in] JsonValue Json value to dump.
+
+ @retval EFI_SUCCESS Json string is printed.
+ @retval Others Errors occur.
+
+**/
+EFI_STATUS
+DumpJsonValue (
+ IN UINTN ErrorLevel,
+ IN EDKII_JSON_VALUE JsonValue
+ );
+
+/**
+
+ This function dump the status code, header and body in given
+ Redfish payload.
+
+ @param[in] ErrorLevel DEBUG macro error level
+ @param[in] Payload Redfish payload to dump
+
+ @retval EFI_SUCCESS Redfish payload is printed.
+ @retval Others Errors occur.
+
+**/
+EFI_STATUS
+DumpRedfishPayload (
+ IN UINTN ErrorLevel,
+ IN REDFISH_PAYLOAD Payload
+ );
+
+/**
+
+ This function dump the status code, header and body in given
+ Redfish response.
+
+ @param[in] Message Message string
+ @param[in] ErrorLevel DEBUG macro error level
+ @param[in] Response Redfish response to dump
+
+ @retval EFI_SUCCESS Redfish response is printed.
+ @retval Others Errors occur.
+
+**/
+EFI_STATUS
+DumpRedfishResponse (
+ IN CONST CHAR8 *Message,
+ IN UINTN ErrorLevel,
+ IN REDFISH_RESPONSE *Response
+ );
+
+/**
+
+ This function dump the HTTP status code.
+
+ @param[in] ErrorLevel DEBUG macro error level
+ @param[in] HttpStatusCode HTTP status code
+
+ @retval EFI_SUCCESS HTTP status code is printed
+
+**/
+EFI_STATUS
+DumpHttpStatusCode (
+ IN UINTN ErrorLevel,
+ IN EFI_HTTP_STATUS_CODE HttpStatusCode
+ );
+
+#endif