--- /dev/null
+/** @file\r
+ Definitinos of RedfishContentCodingLib.\r
+\r
+ (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>\r
+\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+#ifndef REDFISH_CONTENT_CODING_LIB_H_\r
+#define REDFISH_CONTENT_CODING_LIB_H_\r
+\r
+/**\r
+ This is the function to encode the content use the\r
+ algorithm indicated in ContentEncodedValue. The naming of\r
+ ContentEncodedValue is follow HTTP spec or could be a\r
+ platform-specific value.\r
+\r
+ @param[in] ContentEncodedValue HTTP conent encoded value.\r
+ The value could be one of below\r
+ or any which is platform-specific.\r
+ - HTTP_CONTENT_ENCODING_IDENTITY "identity"\r
+ - HTTP_CONTENT_ENCODING_GZIP "gzip"\r
+ - HTTP_CONTENT_ENCODING_COMPRESS "compress"\r
+ - HTTP_CONTENT_ENCODING_DEFLATE "deflate"\r
+ - HTTP_CONTENT_ENCODING_BROTLI "br"\r
+ @param[in] OriginalContent Original content.\r
+ @param[in] OriginalContentLength The length of original content.\r
+ @param[out] EncodedContentPointer Pointer to receive the encoded content pointer.\r
+ @param[out] EncodedContentLength Length of encoded content.\r
+\r
+ @retval EFI_SUCCESS Content is encoded successfully.\r
+ @retval EFI_UNSUPPORTED No supported encoding funciton,\r
+ @retval EFI_INVALID_PARAMETER One of the given parameter is invalid.\r
+\r
+**/\r
+\r
+EFI_STATUS\r
+RedfishContentEncode (\r
+ IN CHAR8 *ContentEncodedValue,\r
+ IN CHAR8 *OriginalContent,\r
+ IN UINTN OriginalContentLength,\r
+ OUT VOID **EncodedContentPointer,\r
+ OUT UINTN *EncodedLength\r
+ );\r
+\r
+/**\r
+ This is the function to decode the content use the\r
+ algorithm indicated in ContentEncodedValue. The naming of\r
+ ContentEncodedValue is follow HTTP spec or could be a\r
+ platform-specific value.\r
+\r
+ @param[in] ContentDecodedValue HTTP conent decoded value.\r
+ The value could be one of below\r
+ or any which is platform-specific.\r
+ - HTTP_CONTENT_ENCODING_IDENTITY "identity"\r
+ - HTTP_CONTENT_ENCODING_GZIP "gzip"\r
+ - HTTP_CONTENT_ENCODING_COMPRESS "compress"\r
+ - HTTP_CONTENT_ENCODING_DEFLATE "deflate"\r
+ - HTTP_CONTENT_ENCODING_BROTLI "br"\r
+ @param[in] ContentPointer Original content.\r
+ @param[in] ContentLength The length of original content.\r
+ @param[out] DecodedContentPointer Pointer to receive decoded content pointer.\r
+ @param[out] DecodedContentLength Length of decoded content.\r
+\r
+ @retval EFI_SUCCESS Content is decoded successfully.\r
+ @retval EFI_UNSUPPORTED No supported decoding funciton,\r
+ @retval EFI_INVALID_PARAMETER One of the given parameter is invalid.\r
+\r
+**/\r
+EFI_STATUS\r
+RedfishContentDecode (\r
+ IN CHAR8 *ContentEncodedValue,\r
+ IN VOID *ContentPointer,\r
+ IN UINTN ContentLength,\r
+ OUT VOID **DecodedContentPointer,\r
+ OUT UINTN *DecodedLength\r
+ );\r
+#endif\r
--- /dev/null
+/** @file\r
+ NULL instace of RedfishContentCodingLib\r
+\r
+ (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>\r
+\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+#include <Uefi.h>\r
+\r
+/**\r
+ This is the function to encode the content use the\r
+ algorithm indicated in ContentEncodedValue. The naming of\r
+ ContentEncodedValue is follow HTTP spec or could be a\r
+ platform-specific value.\r
+\r
+ @param[in] ContentEncodedValue HTTP conent encoded value.\r
+ The value could be one of below\r
+ or any which is platform-specific.\r
+ - HTTP_CONTENT_ENCODING_IDENTITY "identity"\r
+ - HTTP_CONTENT_ENCODING_GZIP "gzip"\r
+ - HTTP_CONTENT_ENCODING_COMPRESS "compress"\r
+ - HTTP_CONTENT_ENCODING_DEFLATE "deflate"\r
+ - HTTP_CONTENT_ENCODING_BROTLI "br"\r
+ @param[in] OriginalContent Original content.\r
+ @param[in] OriginalContentLength The length of original content.\r
+ @param[out] EncodedContentPointer Pointer to receive the encoded content pointer.\r
+ @param[out] EncodedContentLength Length of encoded content.\r
+\r
+ @retval EFI_SUCCESS Content is encoded successfully.\r
+ @retval EFI_UNSUPPORTED No supported encoding funciton,\r
+ @retval EFI_INVALID_PARAMETER One of the given parameter is invalid.\r
+\r
+**/\r
+EFI_STATUS\r
+RedfishContentEncode (\r
+ IN CHAR8 *ContentEncodedValue,\r
+ IN CHAR8 *OriginalContent,\r
+ IN UINTN OriginalContentLength,\r
+ OUT VOID **EncodedContentPointer,\r
+ OUT UINTN *EncodedContentLength\r
+ )\r
+{\r
+ return EFI_UNSUPPORTED;\r
+}\r
+\r
+/**\r
+ This is the function to decode the content use the\r
+ algorithm indicated in ContentEncodedValue. The naming of\r
+ ContentEncodedValue is follow HTTP spec or could be a\r
+ platform-specific value.\r
+\r
+ @param[in] ContentDecodedValue HTTP conent decoded value.\r
+ The value could be one of below\r
+ or any which is platform-specific.\r
+ - HTTP_CONTENT_ENCODING_IDENTITY "identity"\r
+ - HTTP_CONTENT_ENCODING_GZIP "gzip"\r
+ - HTTP_CONTENT_ENCODING_COMPRESS "compress"\r
+ - HTTP_CONTENT_ENCODING_DEFLATE "deflate"\r
+ - HTTP_CONTENT_ENCODING_BROTLI "br"\r
+ @param[in] ContentPointer Original content.\r
+ @param[in] ContentLength The length of original content.\r
+ @param[out] DecodedContentPointer Pointer to receive decoded content pointer.\r
+ @param[out] DecodedContentLength Length of decoded content.\r
+\r
+ @retval EFI_SUCCESS Content is decoded successfully.\r
+ @retval EFI_UNSUPPORTED No supported decoding funciton,\r
+ @retval EFI_INVALID_PARAMETER One of the given parameter is invalid.\r
+\r
+**/\r
+EFI_STATUS\r
+RedfishContentDecode (\r
+ IN CHAR8 *ContentDecodedValue,\r
+ IN VOID *ContentPointer,\r
+ IN UINTN ContentLength,\r
+ OUT VOID **DecodedContentPointer,\r
+ OUT UINTN *DecodedContentLength\r
+ )\r
+{\r
+ return EFI_UNSUPPORTED;\r
+}\r
--- /dev/null
+## @file\r
+# NULL instance of RedfishContentCodingLibNull\r
+# This library is used to encode/decode Redfish payload.\r
+#\r
+# (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>\r
+#\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
+#\r
+##\r
+\r
+[Defines]\r
+ INF_VERSION = 0x0001000b\r
+ BASE_NAME = RedfishContentCodingLibNull\r
+ FILE_GUID = 06B10249-4D38-FF37-0CA5-13AFB6D625CC\r
+ MODULE_TYPE = DXE_DRIVER\r
+ VERSION_STRING = 1.0\r
+ LIBRARY_CLASS = RedfishContentCodingLib\r
+\r
+#\r
+# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 RISCV64\r
+#\r
+\r
+[Sources]\r
+ RedfishContentCodingLibNull.c\r
+\r
+[Packages]\r
+ MdePkg/MdePkg.dec\r
+ MdeModulePkg/MdeModulePkg.dec\r
+ RedfishPkg/RedfishPkg.dec\r
+\r
+\r
# Redfish Package\r
#\r
# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r
-# (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>\r
+# (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>\r
#\r
# SPDX-License-Identifier: BSD-2-Clause-Patent\r
##\r
#\r
JsonLib|Include/Library/JsonLib.h\r
\r
+ ## @libraryclass Provides the library functions to encode/decode\r
+ # Redfish packet.\r
+ #\r
+ RedfishContentCodingLib|Include/Library/RedfishContentCodingLib.h\r
+\r
[LibraryClasses.Common.Private]\r
## @libraryclass Provides the private C runtime library functions.\r
# CRT library is currently used by edk2 JsonLib (open source\r
# Redfish Package\r
#\r
# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r
-# (C) Copyright 2020 Hewlett-Packard Enterprise Development LP.\r
+# (C) Copyright 2021 Hewlett-Packard Enterprise Development LP.\r
#\r
# SPDX-License-Identifier: BSD-2-Clause-Patent\r
#\r
NetLib|NetworkPkg/Library/DxeNetLib/DxeNetLib.inf\r
DpcLib|NetworkPkg/Library/DxeDpcLib/DxeDpcLib.inf\r
RedfishPlatformCredentialLib|RedfishPkg/Library/PlatformCredentialLibNull/PlatformCredentialLibNull.inf\r
+ RedfishContentCodingLib|RedfishPkg/Library/RedfishContentCodingLibNull/RedfishContentCodingLibNull.inf\r
\r
[LibraryClasses.ARM, LibraryClasses.AARCH64]\r
#\r
[Components]\r
RedfishPkg/Library/PlatformHostInterfaceLibNull/PlatformHostInterfaceLibNull.inf\r
RedfishPkg/Library/PlatformCredentialLibNull/PlatformCredentialLibNull.inf\r
+ RedfishPkg/Library/RedfishContentCodingLibNull/RedfishContentCodingLibNull.inf\r
RedfishPkg/Library/DxeRestExLib/DxeRestExLib.inf\r
RedfishPkg/Library/BaseUcs2Utf8Lib/BaseUcs2Utf8Lib.inf\r
RedfishPkg/PrivateLibrary/RedfishCrtLib/RedfishCrtLib.inf\r