public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Nickle Wang" <nickle.wang@hpe.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Chang, Abner (HPS SW/FW Technologist)" <abner.chang@hpe.com>
Cc: Ray Ni <ray.ni@intel.com>, Michael D Kinney <michael.d.kinney@intel.com>
Subject: Re: [edk2-devel] [PATCH] RedfishPkg/RedfishContentCodingLib: EDKII Redfish En/Decode library
Date: Tue, 23 Feb 2021 07:39:19 +0000	[thread overview]
Message-ID: <DF4PR8401MB08120382CAF23AFB23CA84C6FF809@DF4PR8401MB0812.NAMPRD84.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <165B3874796C21EF.15753@groups.io>

Reviewed-by: Nickle Wang <nickle.wang@hpe.com>

Thanks,
Nickle

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Chang,
> Abner (HPS SW/FW Technologist)
> Sent: Monday, January 18, 2021 11:28 AM
> To: devel@edk2.groups.io
> Cc: Wang, Nickle (HPS SW) <nickle.wang@hpe.com>; Ray Ni
> <ray.ni@intel.com>; Michael D Kinney <michael.d.kinney@intel.com>
> Subject: [edk2-devel] [PATCH] 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>
> ---
>  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/RedfishContentCodingLib
> Null.inf
>  create mode 100644 RedfishPkg/Include/Library/RedfishContentCodingLib.h
>  create mode 100644
> RedfishPkg/Library/RedfishContentCodingLibNull/RedfishContentCodingLib
> Null.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.<BR>
> -# (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
> +# (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
>  #
>  # SPDX-License-Identifier: BSD-2-Clause-Patent
>  ##
> @@ -50,6 +50,11 @@
>    #
>    JsonLib|Include/Library/JsonLib.h
> 
> +  ##  @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.<BR>
> -# (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/PlatformCredentialLibNull/
> PlatformCredentialLibNull.inf
> +
> RedfishContentCodingLib|RedfishPkg/Library/RedfishContentCodingLibNull/
> RedfishContentCodingLibNull.inf
> 
>  [LibraryClasses.ARM, LibraryClasses.AARCH64]
>    #
> @@ -49,6 +50,7 @@
>  [Components]
> 
> RedfishPkg/Library/PlatformHostInterfaceLibNull/PlatformHostInterfaceLibN
> ull.inf
>    RedfishPkg/Library/PlatformCredentialLibNull/PlatformCredentialLibNull.inf
> +
> RedfishPkg/Library/RedfishContentCodingLibNull/RedfishContentCodingLib
> Null.inf
>    RedfishPkg/Library/DxeRestExLib/DxeRestExLib.inf
>    RedfishPkg/Library/BaseUcs2Utf8Lib/BaseUcs2Utf8Lib.inf
>    RedfishPkg/PrivateLibrary/RedfishCrtLib/RedfishCrtLib.inf
> diff --git
> a/RedfishPkg/Library/RedfishContentCodingLibNull/RedfishContentCodingLi
> bNull.inf
> b/RedfishPkg/Library/RedfishContentCodingLibNull/RedfishContentCodingLi
> bNull.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<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
> +
> +
> diff --git a/RedfishPkg/Include/Library/RedfishContentCodingLib.h
> b/RedfishPkg/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<BR>
> +
> +  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 "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 *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 "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  *ContentEncodedValue,
> +  IN VOID   *ContentPointer,
> +  IN UINTN  ContentLength,
> +  OUT VOID  **DecodedContentPointer,
> +  OUT UINTN *DecodedLength
> +  );
> +#endif
> diff --git
> a/RedfishPkg/Library/RedfishContentCodingLibNull/RedfishContentCodingLi
> bNull.c
> b/RedfishPkg/Library/RedfishContentCodingLibNull/RedfishContentCodingLi
> bNull.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<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;
> +}
> --
> 2.17.1
> 
> 
> 
> 
> 


           reply	other threads:[~2021-02-23  7:39 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <165B3874796C21EF.15753@groups.io>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DF4PR8401MB08120382CAF23AFB23CA84C6FF809@DF4PR8401MB0812.NAMPRD84.PROD.OUTLOOK.COM \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox