[edk2-devel] [RestJsonStructureDxe PATCH v3 1/3] MdePkg/Include: Definitions of EFI REST JSON Structure Protocol

Abner Chang posted 3 patches 4 years, 1 month ago
There is a newer version of this series
[edk2-devel] [RestJsonStructureDxe PATCH v3 1/3] MdePkg/Include: Definitions of EFI REST JSON Structure Protocol
Posted by Abner Chang 4 years, 1 month ago
Add definitions of EFI REST JSON Structure according to UEFI spec
2.8 Section 29.7.3 EFI REST JSON Resource to C Structure Converter.

Signed-off-by: Abner Chang <abner.chang@hpe.com>

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Fan Wang <fan.wang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
---
 MdePkg/Include/Protocol/RestJsonStructure.h | 161 ++++++++++++++++++++
 MdePkg/MdePkg.dec                           |   3 +
 2 files changed, 164 insertions(+)
 create mode 100644 MdePkg/Include/Protocol/RestJsonStructure.h

diff --git a/MdePkg/Include/Protocol/RestJsonStructure.h b/MdePkg/Include/Protocol/RestJsonStructure.h
new file mode 100644
index 0000000000..adaf148f71
--- /dev/null
+++ b/MdePkg/Include/Protocol/RestJsonStructure.h
@@ -0,0 +1,161 @@
+/** @file
+  This file defines the EFI REST JSON Structure Protocol interface.
+
+  (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+  @par Revision Reference:
+  This Protocol is introduced in UEFI Specification 2.8
+
+**/
+
+#ifndef EFI_REST_JSON_STRUCTURE_PROTOCOL_H_
+#define EFI_REST_JSON_STRUCTURE_PROTOCOL_H_
+
+///
+/// GUID definitions
+///
+#define EFI_REST_JSON_STRUCTURE_PROTOCOL_GUID \
+  { \
+    0xa9a048f6, 0x48a0, 0x4714, {0xb7, 0xda, 0xa9, 0xad,0x87, 0xd4, 0xda, 0xc9 } \
+  }
+
+typedef struct _EFI_REST_JSON_STRUCTURE_PROTOCOL EFI_REST_JSON_STRUCTURE_PROTOCOL;
+typedef CHAR8 * EFI_REST_JSON_RESOURCE_TYPE_DATATYPE;
+
+///
+/// Structure defintions of resource name space.
+///
+/// The fields declared in this structure define the
+/// name and revision of payload delievered throught
+/// REST API.
+///
+typedef struct _EFI_REST_JSON_RESOURCE_TYPE_NAMESPACE {
+  CHAR8 *ResourceTypeName;   ///< Resource type name
+  CHAR8 *MajorVersion;       ///< Resource major version
+  CHAR8 *MinorVersion;       ///< Resource minor version
+  CHAR8 *ErrataVersion;      ///< Resource errata version
+} EFI_REST_JSON_RESOURCE_TYPE_NAMESPACE;
+
+///
+/// REST resource type identifier
+///
+/// REST resource type consists of name space and data type.
+///
+typedef struct _EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER {
+  EFI_REST_JSON_RESOURCE_TYPE_NAMESPACE NameSpace; ///< Namespace of this resource type.
+  EFI_REST_JSON_RESOURCE_TYPE_DATATYPE DataType;   ///< Name of data type declared in this
+                                                   ///< resource type.
+} EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER;
+
+///
+/// List of JSON to C structure conversions which this convertor supports.
+///
+typedef struct _EFI_REST_JSON_STRUCTURE_SUPPORTED {
+  LIST_ENTRY NextSupportedRsrcInterp;                        ///< Linklist to next supported conversion.
+  EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER RestResourceInterp; ///< JSON resource type this convertor supports.
+} EFI_REST_JSON_STRUCTURE_SUPPORTED;
+
+///
+/// The header file of JSON C structure
+///
+typedef struct _EFI_REST_JSON_STRUCTURE_HEADER {
+  EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER    JsonRsrcIdentifier; ///< Resource identifier which use to
+                                                                ///< choice the proper interpreter.
+  ///< Follow by a pointer points to JSON structure, the content in the
+  ///< JSON structure is implementation-specific according to converter producer.
+  VOID  *JsonStructurePointer;
+} EFI_REST_JSON_STRUCTURE_HEADER;
+
+/**
+  JSON-IN C Structure-OUT function. Convert the given REST JSON resource into structure.
+
+  @param[in]    This                This is the EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
+  @param[in]    JsonRsrcIdentifier  This indicates the resource type and version is given in
+                                    ResourceJsonText.
+  @param[in]    ResourceJsonText    REST JSON resource in text format.
+  @param[out]   JsonStructure       Pointer to receive the pointer to EFI_REST_JSON_STRUCTURE_HEADER
+
+  @retval EFI_SUCCESS
+  @retval Others
+--*/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_JSON_STRUCTURE_TO_STRUCTURE)(
+  IN  EFI_REST_JSON_STRUCTURE_PROTOCOL        *This,
+  IN  EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *JsonRsrcIdentifier OPTIONAL,
+  IN  CHAR8                                   *ResourceJsonText,
+  OUT  EFI_REST_JSON_STRUCTURE_HEADER         **JsonStructure
+);
+
+/**
+  Convert the given REST JSON structure into JSON text.
+
+  @param[in]    This                 This is the EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
+  @param[in]    JsonStructureHeader  The point to EFI_REST_JSON_STRUCTURE_HEADER  structure.
+  @param[out]   ResourceJsonText     Pointer to receive REST JSON resource in text format.
+
+  @retval EFI_SUCCESS
+  @retval Others
+
+--*/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_JSON_STRUCTURE_TO_JSON)(
+  IN EFI_REST_JSON_STRUCTURE_PROTOCOL     *This,
+  IN EFI_REST_JSON_STRUCTURE_HEADER       *JsonStructureHeader,
+  OUT CHAR8                               **ResourceJsonText
+);
+
+/**
+  This function destroys the REST JSON structure.
+
+  @param[in]    This                 This is the EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
+  @param[in]    JsonStructureHeader  JSON structure to destroy.
+
+  @retval EFI_SUCCESS
+  @retval Others
+
+--*/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_JSON_STRUCTURE_DESTORY_STRUCTURE)(
+  IN EFI_REST_JSON_STRUCTURE_PROTOCOL   *This,
+  IN EFI_REST_JSON_STRUCTURE_HEADER     *JsonStructureHeader
+);
+/**
+  This function provides REST JSON resource to structure converter registration.
+
+  @param[in]    This                     This is the EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
+  @param[in]    JsonStructureSupported   The type and version of REST JSON resource which this converter
+                                         supports.
+  @param[in]    ToStructure              The function to convert REST JSON resource to structure.
+  @param[in]    ToJson                   The function to convert REST JSON structure to JSON in text format.
+  @param[out]   DestroyStructure         Destroy REST JSON structure returned in ToStructure()  function.
+
+  @retval EFI_SUCCESS             Register successfully.
+  @retval Others                  Fail to register.
+
+--*/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_JSON_STRUCTURE_REGISTER)(
+  IN EFI_REST_JSON_STRUCTURE_PROTOCOL       *This,
+  IN EFI_REST_JSON_STRUCTURE_SUPPORTED      *JsonStructureSupported,
+  IN EFI_REST_JSON_STRUCTURE_TO_STRUCTURE   ToStructure,
+  IN EFI_REST_JSON_STRUCTURE_TO_JSON        ToJson,
+  IN EFI_REST_JSON_STRUCTURE_DESTORY_STRUCTURE DestroyStructure
+);
+
+///
+/// EFI REST JSON to C structure protocol definition.
+///
+struct _EFI_REST_JSON_STRUCTURE_PROTOCOL {
+  EFI_REST_JSON_STRUCTURE_REGISTER           Register;          ///< Register JSON to C structure convertor
+  EFI_REST_JSON_STRUCTURE_TO_STRUCTURE       ToStructure;       ///< The function to convert JSON to C structure
+  EFI_REST_JSON_STRUCTURE_TO_JSON            ToJson;            ///< The function to convert C structure to JSON
+  EFI_REST_JSON_STRUCTURE_DESTORY_STRUCTURE  DestoryStructure;  ///< Destory C structure.
+};
+
+#endif
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index 5205374d62..645f61b80e 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -1855,6 +1855,9 @@
   gEfiRestExProtocolGuid               = { 0x55648b91, 0xe7d, 0x40a3, { 0xa9, 0xb3, 0xa8, 0x15, 0xd7, 0xea, 0xdf, 0x97 }}
   gEfiRestExServiceBindingProtocolGuid = { 0x456bbe01, 0x99d0, 0x45ea, { 0xbb, 0x5f, 0x16, 0xd8, 0x4b, 0xed, 0xc5, 0x59 }}
 
+  ## Include/Protocol/RestJsonStructure.h
+  gEfiRestJsonStructureProtocolGuid  = { 0xa9a048f6, 0x48a0, 0x4714, {0xb7, 0xda, 0xa9, 0xad,0x87, 0xd4, 0xda, 0xc9 }}
+
   #
   # Protocols defined in Shell2.0
   #
-- 
2.17.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#66276): https://edk2.groups.io/g/devel/message/66276
Mute This Topic: https://groups.io/mt/77532168/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [RestJsonStructureDxe PATCH v3 1/3] MdePkg/Include: Definitions of EFI REST JSON Structure Protocol
Posted by Nickle Wang 4 years ago
Hi Abner,

I found an issue on function header of EFI_REST_JSON_STRUCTURE_REGISTER that is not follow UEFI spec.

Thanks,
Nickle

> -----Original Message-----
> From: Chang, Abner (HPS SW/FW Technologist) <abner.chang@hpe.com>
> Sent: Thursday, October 15, 2020 11:49 PM
> To: devel@edk2.groups.io
> Cc: Michael D Kinney <michael.d.kinney@intel.com>; Liming Gao
> <gaoliming@byosoft.com.cn>; Zhiguang Liu <zhiguang.liu@intel.com>; Jiaxin
> Wu <jiaxin.wu@intel.com>; Siyuan Fu <siyuan.fu@intel.com>; Fan Wang
> <fan.wang@intel.com>; Jiewen Yao <jiewen.yao@intel.com>; Wang, Nickle
> (HPS SW) <nickle.wang@hpe.com>
> Subject: [RestJsonStructureDxe PATCH v3 1/3] MdePkg/Include: Definitions
> of EFI REST JSON Structure Protocol
> 
> Add definitions of EFI REST JSON Structure according to UEFI spec
> 2.8 Section 29.7.3 EFI REST JSON Resource to C Structure Converter.
> 
> Signed-off-by: Abner Chang <abner.chang@hpe.com>
> 
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> Cc: Jiaxin Wu <jiaxin.wu@intel.com>
> Cc: Siyuan Fu <siyuan.fu@intel.com>
> Cc: Fan Wang <fan.wang@intel.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Nickle Wang <nickle.wang@hpe.com>
> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
> ---
>  MdePkg/Include/Protocol/RestJsonStructure.h | 161
> ++++++++++++++++++++
>  MdePkg/MdePkg.dec                           |   3 +
>  2 files changed, 164 insertions(+)
>  create mode 100644 MdePkg/Include/Protocol/RestJsonStructure.h
> 
> diff --git a/MdePkg/Include/Protocol/RestJsonStructure.h
> b/MdePkg/Include/Protocol/RestJsonStructure.h
> new file mode 100644
> index 0000000000..adaf148f71
> --- /dev/null
> +++ b/MdePkg/Include/Protocol/RestJsonStructure.h
> @@ -0,0 +1,161 @@
> +/** @file
> +  This file defines the EFI REST JSON Structure Protocol interface.
> +
> +  (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +  @par Revision Reference:
> +  This Protocol is introduced in UEFI Specification 2.8
> +
> +**/
> +
> +#ifndef EFI_REST_JSON_STRUCTURE_PROTOCOL_H_
> +#define EFI_REST_JSON_STRUCTURE_PROTOCOL_H_
> +
> +///
> +/// GUID definitions
> +///
> +#define EFI_REST_JSON_STRUCTURE_PROTOCOL_GUID \
> +  { \
> +    0xa9a048f6, 0x48a0, 0x4714, {0xb7, 0xda, 0xa9, 0xad,0x87, 0xd4, 0xda,
> 0xc9 } \
> +  }
> +
> +typedef struct _EFI_REST_JSON_STRUCTURE_PROTOCOL
> EFI_REST_JSON_STRUCTURE_PROTOCOL;
> +typedef CHAR8 * EFI_REST_JSON_RESOURCE_TYPE_DATATYPE;
> +
> +///
> +/// Structure defintions of resource name space.
> +///
> +/// The fields declared in this structure define the
> +/// name and revision of payload delievered throught
> +/// REST API.
> +///
> +typedef struct _EFI_REST_JSON_RESOURCE_TYPE_NAMESPACE {
> +  CHAR8 *ResourceTypeName;   ///< Resource type name
> +  CHAR8 *MajorVersion;       ///< Resource major version
> +  CHAR8 *MinorVersion;       ///< Resource minor version
> +  CHAR8 *ErrataVersion;      ///< Resource errata version
> +} EFI_REST_JSON_RESOURCE_TYPE_NAMESPACE;
> +
> +///
> +/// REST resource type identifier
> +///
> +/// REST resource type consists of name space and data type.
> +///
> +typedef struct _EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER {
> +  EFI_REST_JSON_RESOURCE_TYPE_NAMESPACE NameSpace; ///<
> Namespace of this resource type.
> +  EFI_REST_JSON_RESOURCE_TYPE_DATATYPE DataType;   ///< Name of
> data type declared in this
> +                                                   ///< resource type.
> +} EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER;
> +
> +///
> +/// List of JSON to C structure conversions which this convertor supports.
> +///
> +typedef struct _EFI_REST_JSON_STRUCTURE_SUPPORTED {
> +  LIST_ENTRY NextSupportedRsrcInterp;                        ///< Linklist to next
> supported conversion.
> +  EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER RestResourceInterp; ///<
> JSON resource type this convertor supports.
> +} EFI_REST_JSON_STRUCTURE_SUPPORTED;
> +
> +///
> +/// The header file of JSON C structure
> +///
> +typedef struct _EFI_REST_JSON_STRUCTURE_HEADER {
> +  EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER    JsonRsrcIdentifier; ///<
> Resource identifier which use to
> +                                                                ///< choice the proper interpreter.
> +  ///< Follow by a pointer points to JSON structure, the content in the
> +  ///< JSON structure is implementation-specific according to converter
> producer.
> +  VOID  *JsonStructurePointer;
> +} EFI_REST_JSON_STRUCTURE_HEADER;
> +
> +/**
> +  JSON-IN C Structure-OUT function. Convert the given REST JSON resource
> into structure.
> +
> +  @param[in]    This                This is the
> EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
> +  @param[in]    JsonRsrcIdentifier  This indicates the resource type and
> version is given in
> +                                    ResourceJsonText.
> +  @param[in]    ResourceJsonText    REST JSON resource in text format.
> +  @param[out]   JsonStructure       Pointer to receive the pointer to
> EFI_REST_JSON_STRUCTURE_HEADER
> +
> +  @retval EFI_SUCCESS
> +  @retval Others
> +--*/
> +typedef
> +EFI_STATUS
> +(EFIAPI *EFI_REST_JSON_STRUCTURE_TO_STRUCTURE)(
> +  IN  EFI_REST_JSON_STRUCTURE_PROTOCOL        *This,
> +  IN  EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *JsonRsrcIdentifier
> OPTIONAL,
> +  IN  CHAR8                                   *ResourceJsonText,
> +  OUT  EFI_REST_JSON_STRUCTURE_HEADER         **JsonStructure
> +);
> +
> +/**
> +  Convert the given REST JSON structure into JSON text.
> +
> +  @param[in]    This                 This is the
> EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
> +  @param[in]    JsonStructureHeader  The point to
> EFI_REST_JSON_STRUCTURE_HEADER  structure.
> +  @param[out]   ResourceJsonText     Pointer to receive REST JSON resource
> in text format.
> +
> +  @retval EFI_SUCCESS
> +  @retval Others
> +
> +--*/
> +typedef
> +EFI_STATUS
> +(EFIAPI *EFI_REST_JSON_STRUCTURE_TO_JSON)(
> +  IN EFI_REST_JSON_STRUCTURE_PROTOCOL     *This,
> +  IN EFI_REST_JSON_STRUCTURE_HEADER       *JsonStructureHeader,
> +  OUT CHAR8                               **ResourceJsonText
> +);
> +
> +/**
> +  This function destroys the REST JSON structure.
> +
> +  @param[in]    This                 This is the
> EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
> +  @param[in]    JsonStructureHeader  JSON structure to destroy.
> +
> +  @retval EFI_SUCCESS
> +  @retval Others
> +
> +--*/
> +typedef
> +EFI_STATUS
> +(EFIAPI *EFI_REST_JSON_STRUCTURE_DESTORY_STRUCTURE)(
> +  IN EFI_REST_JSON_STRUCTURE_PROTOCOL   *This,
> +  IN EFI_REST_JSON_STRUCTURE_HEADER     *JsonStructureHeader
> +);
> +/**
> +  This function provides REST JSON resource to structure converter
> registration.
> +
> +  @param[in]    This                     This is the
> EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
> +  @param[in]    JsonStructureSupported   The type and version of REST JSON
> resource which this converter
> +                                         supports.
> +  @param[in]    ToStructure              The function to convert REST JSON
> resource to structure.
> +  @param[in]    ToJson                   The function to convert REST JSON structure
> to JSON in text format.
> +  @param[out]   DestroyStructure         Destroy REST JSON structure returned
According to UEFI 2.8, this is [in] parameter.

> in ToStructure()  function.
> +
> +  @retval EFI_SUCCESS             Register successfully.
> +  @retval Others                  Fail to register.
> +
> +--*/
> +typedef
> +EFI_STATUS
> +(EFIAPI *EFI_REST_JSON_STRUCTURE_REGISTER)(
> +  IN EFI_REST_JSON_STRUCTURE_PROTOCOL       *This,
> +  IN EFI_REST_JSON_STRUCTURE_SUPPORTED      *JsonStructureSupported,
> +  IN EFI_REST_JSON_STRUCTURE_TO_STRUCTURE   ToStructure,
> +  IN EFI_REST_JSON_STRUCTURE_TO_JSON        ToJson,
> +  IN EFI_REST_JSON_STRUCTURE_DESTORY_STRUCTURE DestroyStructure
> +);
> +
> +///
> +/// EFI REST JSON to C structure protocol definition.
> +///
> +struct _EFI_REST_JSON_STRUCTURE_PROTOCOL {
> +  EFI_REST_JSON_STRUCTURE_REGISTER           Register;          ///< Register
> JSON to C structure convertor
> +  EFI_REST_JSON_STRUCTURE_TO_STRUCTURE       ToStructure;       ///< The
> function to convert JSON to C structure
> +  EFI_REST_JSON_STRUCTURE_TO_JSON            ToJson;            ///< The
> function to convert C structure to JSON
> +  EFI_REST_JSON_STRUCTURE_DESTORY_STRUCTURE  DestoryStructure;
> ///< Destory C structure.
> +};
> +
> +#endif
> diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
> index 5205374d62..645f61b80e 100644
> --- a/MdePkg/MdePkg.dec
> +++ b/MdePkg/MdePkg.dec
> @@ -1855,6 +1855,9 @@
>    gEfiRestExProtocolGuid               = { 0x55648b91, 0xe7d, 0x40a3, { 0xa9, 0xb3,
> 0xa8, 0x15, 0xd7, 0xea, 0xdf, 0x97 }}
>    gEfiRestExServiceBindingProtocolGuid = { 0x456bbe01, 0x99d0, 0x45ea,
> { 0xbb, 0x5f, 0x16, 0xd8, 0x4b, 0xed, 0xc5, 0x59 }}
> 
> +  ## Include/Protocol/RestJsonStructure.h
> +  gEfiRestJsonStructureProtocolGuid  = { 0xa9a048f6, 0x48a0, 0x4714, {0xb7,
> 0xda, 0xa9, 0xad,0x87, 0xd4, 0xda, 0xc9 }}
> +
>    #
>    # Protocols defined in Shell2.0
>    #
> --
> 2.17.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#66736): https://edk2.groups.io/g/devel/message/66736
Mute This Topic: https://groups.io/mt/77532168/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [RestJsonStructureDxe PATCH v3 1/3] MdePkg/Include: Definitions of EFI REST JSON Structure Protocol
Posted by Abner Chang 4 years ago
Thanks for catching this, Nickle. I will fix this in the separate patch. BZ was submitted for this,
https://bugzilla.tianocore.org/show_bug.cgi?id=3030

Thanks

> -----Original Message-----
> From: Wang, Nickle (HPS SW)
> Sent: Thursday, October 29, 2020 2:52 PM
> To: Chang, Abner (HPS SW/FW Technologist) <abner.chang@hpe.com>;
> devel@edk2.groups.io
> Cc: Michael D Kinney <michael.d.kinney@intel.com>; Liming Gao
> <gaoliming@byosoft.com.cn>; Zhiguang Liu <zhiguang.liu@intel.com>; Jiaxin
> Wu <jiaxin.wu@intel.com>; Siyuan Fu <siyuan.fu@intel.com>; Fan Wang
> <fan.wang@intel.com>; Jiewen Yao <jiewen.yao@intel.com>
> Subject: RE: [RestJsonStructureDxe PATCH v3 1/3] MdePkg/Include:
> Definitions of EFI REST JSON Structure Protocol
> 
> Hi Abner,
> 
> I found an issue on function header of
> EFI_REST_JSON_STRUCTURE_REGISTER that is not follow UEFI spec.
> 
> Thanks,
> Nickle
> 
> > -----Original Message-----
> > From: Chang, Abner (HPS SW/FW Technologist) <abner.chang@hpe.com>
> > Sent: Thursday, October 15, 2020 11:49 PM
> > To: devel@edk2.groups.io
> > Cc: Michael D Kinney <michael.d.kinney@intel.com>; Liming Gao
> > <gaoliming@byosoft.com.cn>; Zhiguang Liu <zhiguang.liu@intel.com>;
> > Jiaxin Wu <jiaxin.wu@intel.com>; Siyuan Fu <siyuan.fu@intel.com>; Fan
> > Wang <fan.wang@intel.com>; Jiewen Yao <jiewen.yao@intel.com>; Wang,
> > Nickle (HPS SW) <nickle.wang@hpe.com>
> > Subject: [RestJsonStructureDxe PATCH v3 1/3] MdePkg/Include:
> > Definitions of EFI REST JSON Structure Protocol
> >
> > Add definitions of EFI REST JSON Structure according to UEFI spec
> > 2.8 Section 29.7.3 EFI REST JSON Resource to C Structure Converter.
> >
> > Signed-off-by: Abner Chang <abner.chang@hpe.com>
> >
> > Cc: Michael D Kinney <michael.d.kinney@intel.com>
> > Cc: Liming Gao <gaoliming@byosoft.com.cn>
> > Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> > Cc: Jiaxin Wu <jiaxin.wu@intel.com>
> > Cc: Siyuan Fu <siyuan.fu@intel.com>
> > Cc: Fan Wang <fan.wang@intel.com>
> > Cc: Jiewen Yao <jiewen.yao@intel.com>
> > Cc: Nickle Wang <nickle.wang@hpe.com>
> > Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
> > ---
> >  MdePkg/Include/Protocol/RestJsonStructure.h | 161
> > ++++++++++++++++++++
> >  MdePkg/MdePkg.dec                           |   3 +
> >  2 files changed, 164 insertions(+)
> >  create mode 100644 MdePkg/Include/Protocol/RestJsonStructure.h
> >
> > diff --git a/MdePkg/Include/Protocol/RestJsonStructure.h
> > b/MdePkg/Include/Protocol/RestJsonStructure.h
> > new file mode 100644
> > index 0000000000..adaf148f71
> > --- /dev/null
> > +++ b/MdePkg/Include/Protocol/RestJsonStructure.h
> > @@ -0,0 +1,161 @@
> > +/** @file
> > +  This file defines the EFI REST JSON Structure Protocol interface.
> > +
> > +  (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
> > +
> > +  SPDX-License-Identifier: BSD-2-Clause-Patent
> > +
> > +  @par Revision Reference:
> > +  This Protocol is introduced in UEFI Specification 2.8
> > +
> > +**/
> > +
> > +#ifndef EFI_REST_JSON_STRUCTURE_PROTOCOL_H_
> > +#define EFI_REST_JSON_STRUCTURE_PROTOCOL_H_
> > +
> > +///
> > +/// GUID definitions
> > +///
> > +#define EFI_REST_JSON_STRUCTURE_PROTOCOL_GUID \
> > +  { \
> > +    0xa9a048f6, 0x48a0, 0x4714, {0xb7, 0xda, 0xa9, 0xad,0x87, 0xd4,
> > +0xda,
> > 0xc9 } \
> > +  }
> > +
> > +typedef struct _EFI_REST_JSON_STRUCTURE_PROTOCOL
> > EFI_REST_JSON_STRUCTURE_PROTOCOL;
> > +typedef CHAR8 * EFI_REST_JSON_RESOURCE_TYPE_DATATYPE;
> > +
> > +///
> > +/// Structure defintions of resource name space.
> > +///
> > +/// The fields declared in this structure define the /// name and
> > +revision of payload delievered throught /// REST API.
> > +///
> > +typedef struct _EFI_REST_JSON_RESOURCE_TYPE_NAMESPACE {
> > +  CHAR8 *ResourceTypeName;   ///< Resource type name
> > +  CHAR8 *MajorVersion;       ///< Resource major version
> > +  CHAR8 *MinorVersion;       ///< Resource minor version
> > +  CHAR8 *ErrataVersion;      ///< Resource errata version
> > +} EFI_REST_JSON_RESOURCE_TYPE_NAMESPACE;
> > +
> > +///
> > +/// REST resource type identifier
> > +///
> > +/// REST resource type consists of name space and data type.
> > +///
> > +typedef struct _EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER {
> > +  EFI_REST_JSON_RESOURCE_TYPE_NAMESPACE NameSpace; ///<
> > Namespace of this resource type.
> > +  EFI_REST_JSON_RESOURCE_TYPE_DATATYPE DataType;   ///< Name of
> > data type declared in this
> > +                                                   ///< resource type.
> > +} EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER;
> > +
> > +///
> > +/// List of JSON to C structure conversions which this convertor supports.
> > +///
> > +typedef struct _EFI_REST_JSON_STRUCTURE_SUPPORTED {
> > +  LIST_ENTRY NextSupportedRsrcInterp;                        ///< Linklist to next
> > supported conversion.
> > +  EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER RestResourceInterp; ///<
> > JSON resource type this convertor supports.
> > +} EFI_REST_JSON_STRUCTURE_SUPPORTED;
> > +
> > +///
> > +/// The header file of JSON C structure /// typedef struct
> > +_EFI_REST_JSON_STRUCTURE_HEADER {
> > +  EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER    JsonRsrcIdentifier; ///<
> > Resource identifier which use to
> > +                                                                ///< choice the proper interpreter.
> > +  ///< Follow by a pointer points to JSON structure, the content in
> > + the  ///< JSON structure is implementation-specific according to
> > + converter
> > producer.
> > +  VOID  *JsonStructurePointer;
> > +} EFI_REST_JSON_STRUCTURE_HEADER;
> > +
> > +/**
> > +  JSON-IN C Structure-OUT function. Convert the given REST JSON
> > +resource
> > into structure.
> > +
> > +  @param[in]    This                This is the
> > EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
> > +  @param[in]    JsonRsrcIdentifier  This indicates the resource type and
> > version is given in
> > +                                    ResourceJsonText.
> > +  @param[in]    ResourceJsonText    REST JSON resource in text format.
> > +  @param[out]   JsonStructure       Pointer to receive the pointer to
> > EFI_REST_JSON_STRUCTURE_HEADER
> > +
> > +  @retval EFI_SUCCESS
> > +  @retval Others
> > +--*/
> > +typedef
> > +EFI_STATUS
> > +(EFIAPI *EFI_REST_JSON_STRUCTURE_TO_STRUCTURE)(
> > +  IN  EFI_REST_JSON_STRUCTURE_PROTOCOL        *This,
> > +  IN  EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *JsonRsrcIdentifier
> > OPTIONAL,
> > +  IN  CHAR8                                   *ResourceJsonText,
> > +  OUT  EFI_REST_JSON_STRUCTURE_HEADER         **JsonStructure
> > +);
> > +
> > +/**
> > +  Convert the given REST JSON structure into JSON text.
> > +
> > +  @param[in]    This                 This is the
> > EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
> > +  @param[in]    JsonStructureHeader  The point to
> > EFI_REST_JSON_STRUCTURE_HEADER  structure.
> > +  @param[out]   ResourceJsonText     Pointer to receive REST JSON
> resource
> > in text format.
> > +
> > +  @retval EFI_SUCCESS
> > +  @retval Others
> > +
> > +--*/
> > +typedef
> > +EFI_STATUS
> > +(EFIAPI *EFI_REST_JSON_STRUCTURE_TO_JSON)(
> > +  IN EFI_REST_JSON_STRUCTURE_PROTOCOL     *This,
> > +  IN EFI_REST_JSON_STRUCTURE_HEADER       *JsonStructureHeader,
> > +  OUT CHAR8                               **ResourceJsonText
> > +);
> > +
> > +/**
> > +  This function destroys the REST JSON structure.
> > +
> > +  @param[in]    This                 This is the
> > EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
> > +  @param[in]    JsonStructureHeader  JSON structure to destroy.
> > +
> > +  @retval EFI_SUCCESS
> > +  @retval Others
> > +
> > +--*/
> > +typedef
> > +EFI_STATUS
> > +(EFIAPI *EFI_REST_JSON_STRUCTURE_DESTORY_STRUCTURE)(
> > +  IN EFI_REST_JSON_STRUCTURE_PROTOCOL   *This,
> > +  IN EFI_REST_JSON_STRUCTURE_HEADER     *JsonStructureHeader
> > +);
> > +/**
> > +  This function provides REST JSON resource to structure converter
> > registration.
> > +
> > +  @param[in]    This                     This is the
> > EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
> > +  @param[in]    JsonStructureSupported   The type and version of REST
> JSON
> > resource which this converter
> > +                                         supports.
> > +  @param[in]    ToStructure              The function to convert REST JSON
> > resource to structure.
> > +  @param[in]    ToJson                   The function to convert REST JSON
> structure
> > to JSON in text format.
> > +  @param[out]   DestroyStructure         Destroy REST JSON structure
> returned
> According to UEFI 2.8, this is [in] parameter.
> 
> > in ToStructure()  function.
> > +
> > +  @retval EFI_SUCCESS             Register successfully.
> > +  @retval Others                  Fail to register.
> > +
> > +--*/
> > +typedef
> > +EFI_STATUS
> > +(EFIAPI *EFI_REST_JSON_STRUCTURE_REGISTER)(
> > +  IN EFI_REST_JSON_STRUCTURE_PROTOCOL       *This,
> > +  IN EFI_REST_JSON_STRUCTURE_SUPPORTED
> *JsonStructureSupported,
> > +  IN EFI_REST_JSON_STRUCTURE_TO_STRUCTURE   ToStructure,
> > +  IN EFI_REST_JSON_STRUCTURE_TO_JSON        ToJson,
> > +  IN EFI_REST_JSON_STRUCTURE_DESTORY_STRUCTURE
> DestroyStructure );
> > +
> > +///
> > +/// EFI REST JSON to C structure protocol definition.
> > +///
> > +struct _EFI_REST_JSON_STRUCTURE_PROTOCOL {
> > +  EFI_REST_JSON_STRUCTURE_REGISTER           Register;          ///< Register
> > JSON to C structure convertor
> > +  EFI_REST_JSON_STRUCTURE_TO_STRUCTURE       ToStructure;       ///<
> The
> > function to convert JSON to C structure
> > +  EFI_REST_JSON_STRUCTURE_TO_JSON            ToJson;            ///< The
> > function to convert C structure to JSON
> > +  EFI_REST_JSON_STRUCTURE_DESTORY_STRUCTURE  DestoryStructure;
> > ///< Destory C structure.
> > +};
> > +
> > +#endif
> > diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index
> > 5205374d62..645f61b80e 100644
> > --- a/MdePkg/MdePkg.dec
> > +++ b/MdePkg/MdePkg.dec
> > @@ -1855,6 +1855,9 @@
> >    gEfiRestExProtocolGuid               = { 0x55648b91, 0xe7d, 0x40a3, { 0xa9, 0xb3,
> > 0xa8, 0x15, 0xd7, 0xea, 0xdf, 0x97 }}
> >    gEfiRestExServiceBindingProtocolGuid = { 0x456bbe01, 0x99d0,
> > 0x45ea, { 0xbb, 0x5f, 0x16, 0xd8, 0x4b, 0xed, 0xc5, 0x59 }}
> >
> > +  ## Include/Protocol/RestJsonStructure.h
> > +  gEfiRestJsonStructureProtocolGuid  = { 0xa9a048f6, 0x48a0, 0x4714,
> > + {0xb7,
> > 0xda, 0xa9, 0xad,0x87, 0xd4, 0xda, 0xc9 }}
> > +
> >    #
> >    # Protocols defined in Shell2.0
> >    #
> > --
> > 2.17.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#66786): https://edk2.groups.io/g/devel/message/66786
Mute This Topic: https://groups.io/mt/77532168/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [RestJsonStructureDxe PATCH v3 1/3] MdePkg/Include: Definitions of EFI REST JSON Structure Protocol
Posted by Nickle Wang 4 years ago
I got it. Thanks, Abner.

> -----Original Message-----
> From: Chang, Abner (HPS SW/FW Technologist) <abner.chang@hpe.com>
> Sent: Friday, October 30, 2020 9:32 AM
> To: Wang, Nickle (HPS SW) <nickle.wang@hpe.com>; devel@edk2.groups.io
> Cc: Michael D Kinney <michael.d.kinney@intel.com>; Liming Gao
> <gaoliming@byosoft.com.cn>; Zhiguang Liu <zhiguang.liu@intel.com>; Jiaxin
> Wu <jiaxin.wu@intel.com>; Siyuan Fu <siyuan.fu@intel.com>; Fan Wang
> <fan.wang@intel.com>; Jiewen Yao <jiewen.yao@intel.com>
> Subject: RE: [RestJsonStructureDxe PATCH v3 1/3] MdePkg/Include:
> Definitions of EFI REST JSON Structure Protocol
> 
> Thanks for catching this, Nickle. I will fix this in the separate patch. BZ was
> submitted for this,
> https://bugzilla.tianocore.org/show_bug.cgi?id=3030
> 
> Thanks
> 
> > -----Original Message-----
> > From: Wang, Nickle (HPS SW)
> > Sent: Thursday, October 29, 2020 2:52 PM
> > To: Chang, Abner (HPS SW/FW Technologist) <abner.chang@hpe.com>;
> > devel@edk2.groups.io
> > Cc: Michael D Kinney <michael.d.kinney@intel.com>; Liming Gao
> > <gaoliming@byosoft.com.cn>; Zhiguang Liu <zhiguang.liu@intel.com>;
> > Jiaxin Wu <jiaxin.wu@intel.com>; Siyuan Fu <siyuan.fu@intel.com>; Fan
> > Wang <fan.wang@intel.com>; Jiewen Yao <jiewen.yao@intel.com>
> > Subject: RE: [RestJsonStructureDxe PATCH v3 1/3] MdePkg/Include:
> > Definitions of EFI REST JSON Structure Protocol
> >
> > Hi Abner,
> >
> > I found an issue on function header of
> > EFI_REST_JSON_STRUCTURE_REGISTER that is not follow UEFI spec.
> >
> > Thanks,
> > Nickle
> >
> > > -----Original Message-----
> > > From: Chang, Abner (HPS SW/FW Technologist)
> <abner.chang@hpe.com>
> > > Sent: Thursday, October 15, 2020 11:49 PM
> > > To: devel@edk2.groups.io
> > > Cc: Michael D Kinney <michael.d.kinney@intel.com>; Liming Gao
> > > <gaoliming@byosoft.com.cn>; Zhiguang Liu <zhiguang.liu@intel.com>;
> > > Jiaxin Wu <jiaxin.wu@intel.com>; Siyuan Fu <siyuan.fu@intel.com>;
> > > Fan Wang <fan.wang@intel.com>; Jiewen Yao <jiewen.yao@intel.com>;
> > > Wang, Nickle (HPS SW) <nickle.wang@hpe.com>
> > > Subject: [RestJsonStructureDxe PATCH v3 1/3] MdePkg/Include:
> > > Definitions of EFI REST JSON Structure Protocol
> > >
> > > Add definitions of EFI REST JSON Structure according to UEFI spec
> > > 2.8 Section 29.7.3 EFI REST JSON Resource to C Structure Converter.
> > >
> > > Signed-off-by: Abner Chang <abner.chang@hpe.com>
> > >
> > > Cc: Michael D Kinney <michael.d.kinney@intel.com>
> > > Cc: Liming Gao <gaoliming@byosoft.com.cn>
> > > Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> > > Cc: Jiaxin Wu <jiaxin.wu@intel.com>
> > > Cc: Siyuan Fu <siyuan.fu@intel.com>
> > > Cc: Fan Wang <fan.wang@intel.com>
> > > Cc: Jiewen Yao <jiewen.yao@intel.com>
> > > Cc: Nickle Wang <nickle.wang@hpe.com>
> > > Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
> > > ---
> > >  MdePkg/Include/Protocol/RestJsonStructure.h | 161
> > > ++++++++++++++++++++
> > >  MdePkg/MdePkg.dec                           |   3 +
> > >  2 files changed, 164 insertions(+)
> > >  create mode 100644 MdePkg/Include/Protocol/RestJsonStructure.h
> > >
> > > diff --git a/MdePkg/Include/Protocol/RestJsonStructure.h
> > > b/MdePkg/Include/Protocol/RestJsonStructure.h
> > > new file mode 100644
> > > index 0000000000..adaf148f71
> > > --- /dev/null
> > > +++ b/MdePkg/Include/Protocol/RestJsonStructure.h
> > > @@ -0,0 +1,161 @@
> > > +/** @file
> > > +  This file defines the EFI REST JSON Structure Protocol interface.
> > > +
> > > +  (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
> > > +
> > > +  SPDX-License-Identifier: BSD-2-Clause-Patent
> > > +
> > > +  @par Revision Reference:
> > > +  This Protocol is introduced in UEFI Specification 2.8
> > > +
> > > +**/
> > > +
> > > +#ifndef EFI_REST_JSON_STRUCTURE_PROTOCOL_H_
> > > +#define EFI_REST_JSON_STRUCTURE_PROTOCOL_H_
> > > +
> > > +///
> > > +/// GUID definitions
> > > +///
> > > +#define EFI_REST_JSON_STRUCTURE_PROTOCOL_GUID \
> > > +  { \
> > > +    0xa9a048f6, 0x48a0, 0x4714, {0xb7, 0xda, 0xa9, 0xad,0x87, 0xd4,
> > > +0xda,
> > > 0xc9 } \
> > > +  }
> > > +
> > > +typedef struct _EFI_REST_JSON_STRUCTURE_PROTOCOL
> > > EFI_REST_JSON_STRUCTURE_PROTOCOL;
> > > +typedef CHAR8 * EFI_REST_JSON_RESOURCE_TYPE_DATATYPE;
> > > +
> > > +///
> > > +/// Structure defintions of resource name space.
> > > +///
> > > +/// The fields declared in this structure define the /// name and
> > > +revision of payload delievered throught /// REST API.
> > > +///
> > > +typedef struct _EFI_REST_JSON_RESOURCE_TYPE_NAMESPACE {
> > > +  CHAR8 *ResourceTypeName;   ///< Resource type name
> > > +  CHAR8 *MajorVersion;       ///< Resource major version
> > > +  CHAR8 *MinorVersion;       ///< Resource minor version
> > > +  CHAR8 *ErrataVersion;      ///< Resource errata version
> > > +} EFI_REST_JSON_RESOURCE_TYPE_NAMESPACE;
> > > +
> > > +///
> > > +/// REST resource type identifier
> > > +///
> > > +/// REST resource type consists of name space and data type.
> > > +///
> > > +typedef struct _EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER {
> > > +  EFI_REST_JSON_RESOURCE_TYPE_NAMESPACE NameSpace; ///<
> > > Namespace of this resource type.
> > > +  EFI_REST_JSON_RESOURCE_TYPE_DATATYPE DataType;   ///< Name of
> > > data type declared in this
> > > +                                                   ///< resource type.
> > > +} EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER;
> > > +
> > > +///
> > > +/// List of JSON to C structure conversions which this convertor supports.
> > > +///
> > > +typedef struct _EFI_REST_JSON_STRUCTURE_SUPPORTED {
> > > +  LIST_ENTRY NextSupportedRsrcInterp;                        ///< Linklist to next
> > > supported conversion.
> > > +  EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER RestResourceInterp;
> ///<
> > > JSON resource type this convertor supports.
> > > +} EFI_REST_JSON_STRUCTURE_SUPPORTED;
> > > +
> > > +///
> > > +/// The header file of JSON C structure /// typedef struct
> > > +_EFI_REST_JSON_STRUCTURE_HEADER {
> > > +  EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER    JsonRsrcIdentifier; ///<
> > > Resource identifier which use to
> > > +                                                                ///< choice the proper interpreter.
> > > +  ///< Follow by a pointer points to JSON structure, the content in
> > > + the  ///< JSON structure is implementation-specific according to
> > > + converter
> > > producer.
> > > +  VOID  *JsonStructurePointer;
> > > +} EFI_REST_JSON_STRUCTURE_HEADER;
> > > +
> > > +/**
> > > +  JSON-IN C Structure-OUT function. Convert the given REST JSON
> > > +resource
> > > into structure.
> > > +
> > > +  @param[in]    This                This is the
> > > EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
> > > +  @param[in]    JsonRsrcIdentifier  This indicates the resource type and
> > > version is given in
> > > +                                    ResourceJsonText.
> > > +  @param[in]    ResourceJsonText    REST JSON resource in text format.
> > > +  @param[out]   JsonStructure       Pointer to receive the pointer to
> > > EFI_REST_JSON_STRUCTURE_HEADER
> > > +
> > > +  @retval EFI_SUCCESS
> > > +  @retval Others
> > > +--*/
> > > +typedef
> > > +EFI_STATUS
> > > +(EFIAPI *EFI_REST_JSON_STRUCTURE_TO_STRUCTURE)(
> > > +  IN  EFI_REST_JSON_STRUCTURE_PROTOCOL        *This,
> > > +  IN  EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *JsonRsrcIdentifier
> > > OPTIONAL,
> > > +  IN  CHAR8                                   *ResourceJsonText,
> > > +  OUT  EFI_REST_JSON_STRUCTURE_HEADER         **JsonStructure
> > > +);
> > > +
> > > +/**
> > > +  Convert the given REST JSON structure into JSON text.
> > > +
> > > +  @param[in]    This                 This is the
> > > EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
> > > +  @param[in]    JsonStructureHeader  The point to
> > > EFI_REST_JSON_STRUCTURE_HEADER  structure.
> > > +  @param[out]   ResourceJsonText     Pointer to receive REST JSON
> > resource
> > > in text format.
> > > +
> > > +  @retval EFI_SUCCESS
> > > +  @retval Others
> > > +
> > > +--*/
> > > +typedef
> > > +EFI_STATUS
> > > +(EFIAPI *EFI_REST_JSON_STRUCTURE_TO_JSON)(
> > > +  IN EFI_REST_JSON_STRUCTURE_PROTOCOL     *This,
> > > +  IN EFI_REST_JSON_STRUCTURE_HEADER       *JsonStructureHeader,
> > > +  OUT CHAR8                               **ResourceJsonText
> > > +);
> > > +
> > > +/**
> > > +  This function destroys the REST JSON structure.
> > > +
> > > +  @param[in]    This                 This is the
> > > EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
> > > +  @param[in]    JsonStructureHeader  JSON structure to destroy.
> > > +
> > > +  @retval EFI_SUCCESS
> > > +  @retval Others
> > > +
> > > +--*/
> > > +typedef
> > > +EFI_STATUS
> > > +(EFIAPI *EFI_REST_JSON_STRUCTURE_DESTORY_STRUCTURE)(
> > > +  IN EFI_REST_JSON_STRUCTURE_PROTOCOL   *This,
> > > +  IN EFI_REST_JSON_STRUCTURE_HEADER     *JsonStructureHeader
> > > +);
> > > +/**
> > > +  This function provides REST JSON resource to structure converter
> > > registration.
> > > +
> > > +  @param[in]    This                     This is the
> > > EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
> > > +  @param[in]    JsonStructureSupported   The type and version of REST
> > JSON
> > > resource which this converter
> > > +                                         supports.
> > > +  @param[in]    ToStructure              The function to convert REST JSON
> > > resource to structure.
> > > +  @param[in]    ToJson                   The function to convert REST JSON
> > structure
> > > to JSON in text format.
> > > +  @param[out]   DestroyStructure         Destroy REST JSON structure
> > returned
> > According to UEFI 2.8, this is [in] parameter.
> >
> > > in ToStructure()  function.
> > > +
> > > +  @retval EFI_SUCCESS             Register successfully.
> > > +  @retval Others                  Fail to register.
> > > +
> > > +--*/
> > > +typedef
> > > +EFI_STATUS
> > > +(EFIAPI *EFI_REST_JSON_STRUCTURE_REGISTER)(
> > > +  IN EFI_REST_JSON_STRUCTURE_PROTOCOL       *This,
> > > +  IN EFI_REST_JSON_STRUCTURE_SUPPORTED
> > *JsonStructureSupported,
> > > +  IN EFI_REST_JSON_STRUCTURE_TO_STRUCTURE   ToStructure,
> > > +  IN EFI_REST_JSON_STRUCTURE_TO_JSON        ToJson,
> > > +  IN EFI_REST_JSON_STRUCTURE_DESTORY_STRUCTURE
> > DestroyStructure );
> > > +
> > > +///
> > > +/// EFI REST JSON to C structure protocol definition.
> > > +///
> > > +struct _EFI_REST_JSON_STRUCTURE_PROTOCOL {
> > > +  EFI_REST_JSON_STRUCTURE_REGISTER           Register;          ///<
> Register
> > > JSON to C structure convertor
> > > +  EFI_REST_JSON_STRUCTURE_TO_STRUCTURE       ToStructure;       ///<
> > The
> > > function to convert JSON to C structure
> > > +  EFI_REST_JSON_STRUCTURE_TO_JSON            ToJson;            ///< The
> > > function to convert C structure to JSON
> > > +  EFI_REST_JSON_STRUCTURE_DESTORY_STRUCTURE  DestoryStructure;
> > > ///< Destory C structure.
> > > +};
> > > +
> > > +#endif
> > > diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index
> > > 5205374d62..645f61b80e 100644
> > > --- a/MdePkg/MdePkg.dec
> > > +++ b/MdePkg/MdePkg.dec
> > > @@ -1855,6 +1855,9 @@
> > >    gEfiRestExProtocolGuid               = { 0x55648b91, 0xe7d, 0x40a3, { 0xa9,
> 0xb3,
> > > 0xa8, 0x15, 0xd7, 0xea, 0xdf, 0x97 }}
> > >    gEfiRestExServiceBindingProtocolGuid = { 0x456bbe01, 0x99d0,
> > > 0x45ea, { 0xbb, 0x5f, 0x16, 0xd8, 0x4b, 0xed, 0xc5, 0x59 }}
> > >
> > > +  ## Include/Protocol/RestJsonStructure.h
> > > +  gEfiRestJsonStructureProtocolGuid  = { 0xa9a048f6, 0x48a0,
> > > + 0x4714, {0xb7,
> > > 0xda, 0xa9, 0xad,0x87, 0xd4, 0xda, 0xc9 }}
> > > +
> > >    #
> > >    # Protocols defined in Shell2.0
> > >    #
> > > --
> > > 2.17.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#66849): https://edk2.groups.io/g/devel/message/66849
Mute This Topic: https://groups.io/mt/77532168/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-