summaryrefslogtreecommitdiffstats
path: root/RedfishPkg/Library
diff options
context:
space:
mode:
authorAbner Chang <abner.chang@hpe.com>2021-01-18 10:58:25 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-02-24 10:53:08 +0000
commit35f87da8a2debd443ac842db0a3794b17914a8f4 (patch)
treef0d69a23b72025ecae24356f1f78205bdf9ae1f4 /RedfishPkg/Library
parent69637f91c70294d1969aec4556c31f603324c449 (diff)
downloadedk2-35f87da8a2debd443ac842db0a3794b17914a8f4.tar.gz
edk2-35f87da8a2debd443ac842db0a3794b17914a8f4.tar.bz2
edk2-35f87da8a2debd443ac842db0a3794b17914a8f4.zip
RedfishPkg/RedfishContentCodingLib: EDKII Redfish En/Decode library
BZ#:3174 Platform library to provide the encoding/decoding algorithms for the Redfish packets. The supported value could be one of below or any which is platform-specific. - HTTP_CONTENT_ENCODING_IDENTITY "identity" - HTTP_CONTENT_ENCODING_GZIP "gzip" - HTTP_CONTENT_ENCODING_COMPRESS "compress" - HTTP_CONTENT_ENCODING_DEFLATE "deflate" - HTTP_CONTENT_ENCODING_BROTLI "br" Signed-off-by: Abner Chang <abner.chang@hpe.com> Cc: Nickle Wang <nickle.wang@hpe.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Nickle Wang <nickle.wang@hpe.com>
Diffstat (limited to 'RedfishPkg/Library')
-rw-r--r--RedfishPkg/Library/RedfishContentCodingLibNull/RedfishContentCodingLibNull.c81
-rw-r--r--RedfishPkg/Library/RedfishContentCodingLibNull/RedfishContentCodingLibNull.inf31
2 files changed, 112 insertions, 0 deletions
diff --git a/RedfishPkg/Library/RedfishContentCodingLibNull/RedfishContentCodingLibNull.c b/RedfishPkg/Library/RedfishContentCodingLibNull/RedfishContentCodingLibNull.c
new file mode 100644
index 0000000000..6d13256e83
--- /dev/null
+++ b/RedfishPkg/Library/RedfishContentCodingLibNull/RedfishContentCodingLibNull.c
@@ -0,0 +1,81 @@
+/** @file
+ NULL instace of RedfishContentCodingLib
+
+ (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+#include <Uefi.h>
+
+/**
+ This is the function to encode the content use the
+ algorithm indicated in ContentEncodedValue. The naming of
+ ContentEncodedValue is follow HTTP spec or could be a
+ platform-specific value.
+
+ @param[in] ContentEncodedValue HTTP conent encoded value.
+ The value could be one of below
+ or any which is platform-specific.
+ - HTTP_CONTENT_ENCODING_IDENTITY "identity"
+ - HTTP_CONTENT_ENCODING_GZIP "gzip"
+ - HTTP_CONTENT_ENCODING_COMPRESS "compress"
+ - HTTP_CONTENT_ENCODING_DEFLATE "deflate"
+ - HTTP_CONTENT_ENCODING_BROTLI "br"
+ @param[in] OriginalContent Original content.
+ @param[in] OriginalContentLength The length of original content.
+ @param[out] EncodedContentPointer Pointer to receive the encoded content pointer.
+ @param[out] EncodedContentLength Length of encoded content.
+
+ @retval EFI_SUCCESS Content is encoded successfully.
+ @retval EFI_UNSUPPORTED No supported encoding funciton,
+ @retval EFI_INVALID_PARAMETER One of the given parameter is invalid.
+
+**/
+EFI_STATUS
+RedfishContentEncode (
+ IN CHAR8 *ContentEncodedValue,
+ IN CHAR8 *OriginalContent,
+ IN UINTN OriginalContentLength,
+ OUT VOID **EncodedContentPointer,
+ OUT UINTN *EncodedContentLength
+ )
+{
+ return EFI_UNSUPPORTED;
+}
+
+/**
+ This is the function to decode the content use the
+ algorithm indicated in ContentEncodedValue. The naming of
+ ContentEncodedValue is follow HTTP spec or could be a
+ platform-specific value.
+
+ @param[in] ContentDecodedValue HTTP conent decoded value.
+ The value could be one of below
+ or any which is platform-specific.
+ - HTTP_CONTENT_ENCODING_IDENTITY "identity"
+ - HTTP_CONTENT_ENCODING_GZIP "gzip"
+ - HTTP_CONTENT_ENCODING_COMPRESS "compress"
+ - HTTP_CONTENT_ENCODING_DEFLATE "deflate"
+ - HTTP_CONTENT_ENCODING_BROTLI "br"
+ @param[in] ContentPointer Original content.
+ @param[in] ContentLength The length of original content.
+ @param[out] DecodedContentPointer Pointer to receive decoded content pointer.
+ @param[out] DecodedContentLength Length of decoded content.
+
+ @retval EFI_SUCCESS Content is decoded successfully.
+ @retval EFI_UNSUPPORTED No supported decoding funciton,
+ @retval EFI_INVALID_PARAMETER One of the given parameter is invalid.
+
+**/
+EFI_STATUS
+RedfishContentDecode (
+ IN CHAR8 *ContentDecodedValue,
+ IN VOID *ContentPointer,
+ IN UINTN ContentLength,
+ OUT VOID **DecodedContentPointer,
+ OUT UINTN *DecodedContentLength
+ )
+{
+ return EFI_UNSUPPORTED;
+}
diff --git a/RedfishPkg/Library/RedfishContentCodingLibNull/RedfishContentCodingLibNull.inf b/RedfishPkg/Library/RedfishContentCodingLibNull/RedfishContentCodingLibNull.inf
new file mode 100644
index 0000000000..d8c5cb583e
--- /dev/null
+++ b/RedfishPkg/Library/RedfishContentCodingLibNull/RedfishContentCodingLibNull.inf
@@ -0,0 +1,31 @@
+## @file
+# NULL instance of RedfishContentCodingLibNull
+# This library is used to encode/decode Redfish payload.
+#
+# (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x0001000b
+ BASE_NAME = RedfishContentCodingLibNull
+ FILE_GUID = 06B10249-4D38-FF37-0CA5-13AFB6D625CC
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = RedfishContentCodingLib
+
+#
+# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 RISCV64
+#
+
+[Sources]
+ RedfishContentCodingLibNull.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ RedfishPkg/RedfishPkg.dec
+
+