From nobody Mon Nov 25 10:56:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+70477+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70477+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=hpe.com ARC-Seal: i=1; a=rsa-sha256; t=1610943370; cv=none; d=zohomail.com; s=zohoarc; b=Fj9ZodwNndt/Nphsy/4TqHU0+zy/2s1TFrw1PeZcMZ4b8ShFILBVGZmLflO6bBebhJmPYrvbfCS9+x6+vhIdpwVrb4w8LfmtNjfzMc7IihiXALCpkofEwEyw/UmeMJeOMQ4EdpCLuZ3x+D9FAIyZvzF2QXrADl+mhMz83RExVwk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610943370; h=Cc:Date:From:List-Id:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To; bh=kFU9bVaXAXYVnoRMQXUPhikwmg9nZ+8dzaIGZ/hju+Y=; b=Enju5eidFejl8UW/jYVgiVpKEkUPETBez9UiY0rdXGjOYaq2ZfgrtR6sjk3DyfNiMzvizO9whOb7lCaWdWCd/Fj4/mimsRoo65zgDscZm56kSHL8WgH0hAH2yA6MAhhkZmBbMttZPVWvp7wiekF78nWTsYwQzNWuUV/WuuHC6O8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70477+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 161094337012452.23910905802245; Sun, 17 Jan 2021 20:16:10 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 0x6mYY1788612x7E4veR3QpP; Sun, 17 Jan 2021 20:16:09 -0800 X-Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web11.29078.1610943364453106636 for ; Sun, 17 Jan 2021 20:16:04 -0800 X-Received: from pps.filterd (m0134420.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 10I4Do7I011864; Mon, 18 Jan 2021 04:16:04 GMT X-Received: from g4t3427.houston.hpe.com (g4t3427.houston.hpe.com [15.241.140.73]) by mx0b-002e3701.pphosted.com with ESMTP id 3649tunkq5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Jan 2021 04:16:03 +0000 X-Received: from g9t2301.houston.hpecorp.net (g9t2301.houston.hpecorp.net [16.220.97.129]) by g4t3427.houston.hpe.com (Postfix) with ESMTP id 1E9E672; Mon, 18 Jan 2021 04:16:03 +0000 (UTC) X-Received: from abner-virtual-machine.asiapacific.hpqcorp.net (abner-virtual-machine.asiapacific.hpqcorp.net [15.119.210.153]) by g9t2301.houston.hpecorp.net (Postfix) with ESMTP id A15944B; Mon, 18 Jan 2021 04:16:01 +0000 (UTC) From: "Abner Chang" To: devel@edk2.groups.io Cc: Nickle Wang , Ray Ni , Michael D Kinney Subject: [edk2-devel] [PATCH] RedfishPkg/RedfishContentCodingLib: EDKII Redfish En/Decode library Date: Mon, 18 Jan 2021 11:27:43 +0800 Message-Id: <20210118032743.10632-1-abner.chang@hpe.com> X-HPE-SCL: -1 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,abner.chang@hpe.com X-Gm-Message-State: EKHBJZfuOvbALWUMKj8f9GnLx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610943369; bh=fJe+k+CEYsq/VOnacbK8xpEPCOEWnYkib7+K6VZgLdw=; h=Cc:Date:From:Reply-To:Subject:To; b=L8q4RX2JcSLHhTRJNnEpm8tktAXXYn4GWvwaj+2Yx2eXEhfHeVmteI8D+ElDlSxW0gr x649d5lzSQd0InNtU/Ead9N+cVgsqwpCqV+b65GyPXidU0N3p+Y4rQ1/gutqXg0bnQ5TP fvhi9PL+prQyxDI68P1CbDWozRn6l2F/0ZI= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Cc: Nickle Wang Cc: Ray Ni Cc: Michael D Kinney --- RedfishPkg/RedfishPkg.dec | 7 +- RedfishPkg/RedfishPkg.dsc | 4 +- .../RedfishContentCodingLibNull.inf | 31 +++++++ .../Include/Library/RedfishContentCodingLib.h | 78 ++++++++++++++++++ .../RedfishContentCodingLibNull.c | 81 +++++++++++++++++++ 5 files changed, 199 insertions(+), 2 deletions(-) create mode 100644 RedfishPkg/Library/RedfishContentCodingLibNull/RedfishC= ontentCodingLibNull.inf create mode 100644 RedfishPkg/Include/Library/RedfishContentCodingLib.h create mode 100644 RedfishPkg/Library/RedfishContentCodingLibNull/RedfishC= ontentCodingLibNull.c diff --git a/RedfishPkg/RedfishPkg.dec b/RedfishPkg/RedfishPkg.dec index 2985676b60..016d0e87d3 100644 --- a/RedfishPkg/RedfishPkg.dec +++ b/RedfishPkg/RedfishPkg.dec @@ -2,7 +2,7 @@ # Redfish Package # # Copyright (c) 2019, Intel Corporation. All rights reserved.
-# (C) Copyright 2020 Hewlett Packard Enterprise Development LP
+# (C) Copyright 2021 Hewlett Packard Enterprise Development LP
# # SPDX-License-Identifier: BSD-2-Clause-Patent ## @@ -50,6 +50,11 @@ # JsonLib|Include/Library/JsonLib.h =20 + ## @libraryclass Provides the library functions to encode/decode + # Redfish packet. + # + RedfishContentCodingLib|Include/Library/RedfishContentCodingLib.h + [LibraryClasses.Common.Private] ## @libraryclass Provides the private C runtime library functions. # CRT library is currently used by edk2 JsonLib (open source diff --git a/RedfishPkg/RedfishPkg.dsc b/RedfishPkg/RedfishPkg.dsc index bffa8f1f89..2cae8a46d8 100644 --- a/RedfishPkg/RedfishPkg.dsc +++ b/RedfishPkg/RedfishPkg.dsc @@ -2,7 +2,7 @@ # Redfish Package # # Copyright (c) 2019, Intel Corporation. All rights reserved.
-# (C) Copyright 2020 Hewlett-Packard Enterprise Development LP. +# (C) Copyright 2021 Hewlett-Packard Enterprise Development LP. # # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -37,6 +37,7 @@ NetLib|NetworkPkg/Library/DxeNetLib/DxeNetLib.inf DpcLib|NetworkPkg/Library/DxeDpcLib/DxeDpcLib.inf RedfishPlatformCredentialLib|RedfishPkg/Library/PlatformCredentialLibNul= l/PlatformCredentialLibNull.inf + RedfishContentCodingLib|RedfishPkg/Library/RedfishContentCodingLibNull/R= edfishContentCodingLibNull.inf =20 [LibraryClasses.ARM, LibraryClasses.AARCH64] # @@ -49,6 +50,7 @@ [Components] RedfishPkg/Library/PlatformHostInterfaceLibNull/PlatformHostInterfaceLib= Null.inf RedfishPkg/Library/PlatformCredentialLibNull/PlatformCredentialLibNull.i= nf + RedfishPkg/Library/RedfishContentCodingLibNull/RedfishContentCodingLibNu= ll.inf RedfishPkg/Library/DxeRestExLib/DxeRestExLib.inf RedfishPkg/Library/BaseUcs2Utf8Lib/BaseUcs2Utf8Lib.inf RedfishPkg/PrivateLibrary/RedfishCrtLib/RedfishCrtLib.inf diff --git a/RedfishPkg/Library/RedfishContentCodingLibNull/RedfishContentC= odingLibNull.inf b/RedfishPkg/Library/RedfishContentCodingLibNull/RedfishCo= ntentCodingLibNull.inf new file mode 100644 index 0000000000..d8c5cb583e --- /dev/null +++ b/RedfishPkg/Library/RedfishContentCodingLibNull/RedfishContentCodingLi= bNull.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
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001000b + BASE_NAME =3D RedfishContentCodingLibNull + FILE_GUID =3D 06B10249-4D38-FF37-0CA5-13AFB6D625CC + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D RedfishContentCodingLib + +# +# VALID_ARCHITECTURES =3D IA32 X64 ARM AARCH64 RISCV64 +# + +[Sources] + RedfishContentCodingLibNull.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + RedfishPkg/RedfishPkg.dec + + diff --git a/RedfishPkg/Include/Library/RedfishContentCodingLib.h b/Redfish= Pkg/Include/Library/RedfishContentCodingLib.h new file mode 100644 index 0000000000..71a8adcb26 --- /dev/null +++ b/RedfishPkg/Include/Library/RedfishContentCodingLib.h @@ -0,0 +1,78 @@ +/** @file + Definitinos of RedfishContentCodingLib. + + (C) Copyright 2021 Hewlett Packard Enterprise Development LP
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ +#ifndef REDFISH_CONTENT_CODING_LIB_H_ +#define REDFISH_CONTENT_CODING_LIB_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 "i= dentity" + - HTTP_CONTENT_ENCODING_GZIP "g= zip" + - HTTP_CONTENT_ENCODING_COMPRESS "c= ompress" + - HTTP_CONTENT_ENCODING_DEFLATE "d= eflate" + - HTTP_CONTENT_ENCODING_BROTLI "b= r" + @param[in] OriginalContent Original content. + @param[in] OriginalContentLength The length of original content. + @param[out] EncodedContentPointer Pointer to receive the encoded conten= t 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 *EncodedLength + ); + +/** + 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 "i= dentity" + - HTTP_CONTENT_ENCODING_GZIP "g= zip" + - HTTP_CONTENT_ENCODING_COMPRESS "c= ompress" + - HTTP_CONTENT_ENCODING_DEFLATE "d= eflate" + - HTTP_CONTENT_ENCODING_BROTLI "b= r" + @param[in] ContentPointer Original content. + @param[in] ContentLength The length of original content. + @param[out] DecodedContentPointer Pointer to receive decoded content po= inter. + @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 *ContentEncodedValue, + IN VOID *ContentPointer, + IN UINTN ContentLength, + OUT VOID **DecodedContentPointer, + OUT UINTN *DecodedLength + ); +#endif diff --git a/RedfishPkg/Library/RedfishContentCodingLibNull/RedfishContentC= odingLibNull.c b/RedfishPkg/Library/RedfishContentCodingLibNull/RedfishCont= entCodingLibNull.c new file mode 100644 index 0000000000..6d13256e83 --- /dev/null +++ b/RedfishPkg/Library/RedfishContentCodingLibNull/RedfishContentCodingLi= bNull.c @@ -0,0 +1,81 @@ +/** @file + NULL instace of RedfishContentCodingLib + + (C) Copyright 2021 Hewlett Packard Enterprise Development LP
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ +#include + +/** + 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 "i= dentity" + - HTTP_CONTENT_ENCODING_GZIP "g= zip" + - HTTP_CONTENT_ENCODING_COMPRESS "c= ompress" + - HTTP_CONTENT_ENCODING_DEFLATE "d= eflate" + - HTTP_CONTENT_ENCODING_BROTLI "b= r" + @param[in] OriginalContent Original content. + @param[in] OriginalContentLength The length of original content. + @param[out] EncodedContentPointer Pointer to receive the encoded conten= t 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 "i= dentity" + - HTTP_CONTENT_ENCODING_GZIP "g= zip" + - HTTP_CONTENT_ENCODING_COMPRESS "c= ompress" + - HTTP_CONTENT_ENCODING_DEFLATE "d= eflate" + - HTTP_CONTENT_ENCODING_BROTLI "b= r" + @param[in] ContentPointer Original content. + @param[in] ContentLength The length of original content. + @param[out] DecodedContentPointer Pointer to receive decoded content po= inter. + @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; +} --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#70477): https://edk2.groups.io/g/devel/message/70477 Mute This Topic: https://groups.io/mt/79916008/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-