TianoCore EDK2 master
Loading...
Searching...
No Matches
RestJsonStructureDxe.c File Reference

Go to the source code of this file.

Functions

EFI_STATUS EFIAPI RestJsonStructureRegister (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_STATUS InterpreterInstanceToStruct (IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This, IN REST_JSON_STRUCTURE_INSTANCE *InterpreterInstance, IN EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *RsrcTypeIdentifier OPTIONAL, IN CHAR8 *ResourceRaw, OUT EFI_REST_JSON_STRUCTURE_HEADER **RestJSonHeader)
 
EFI_STATUS InterpreterEfiStructToInstance (IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This, IN REST_JSON_STRUCTURE_INSTANCE *InterpreterInstance, IN EFI_REST_JSON_STRUCTURE_HEADER *RestJSonHeader, OUT CHAR8 **ResourceRaw)
 
EFI_STATUS InterpreterInstanceDestoryJsonStruct (IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This, IN REST_JSON_STRUCTURE_INSTANCE *InterpreterInstance, IN EFI_REST_JSON_STRUCTURE_HEADER *RestJSonHeader)
 
EFI_STATUS EFIAPI RestJsonStructureToStruct (IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This, IN EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *RsrcTypeIdentifier OPTIONAL, IN CHAR8 *ResourceJsonText, OUT EFI_REST_JSON_STRUCTURE_HEADER **JsonStructure)
 
EFI_STATUS EFIAPI RestJsonStructureDestroyStruct (IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This, IN EFI_REST_JSON_STRUCTURE_HEADER *RestJSonHeader)
 
EFI_STATUS EFIAPI RestJsonStructureToJson (IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This, IN EFI_REST_JSON_STRUCTURE_HEADER *RestJSonHeader, OUT CHAR8 **ResourceRaw)
 
EFI_STATUS EFIAPI RestJsonStructureEntryPoint (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 
EFI_STATUS EFIAPI RestJsonStructureUnload (IN EFI_HANDLE ImageHandle)
 

Variables

LIST_ENTRY mRestJsonStructureList
 
EFI_HANDLE mProtocolHandle
 
EFI_REST_JSON_STRUCTURE_PROTOCOL mRestJsonStructureProtocol
 

Detailed Description

The implementation of EFI REST Resource JSON to C structure convertor Protocol.

(C) Copyright 2020 Hewlett Packard Enterprise Development LP
Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file RestJsonStructureDxe.c.

Function Documentation

◆ InterpreterEfiStructToInstance()

EFI_STATUS InterpreterEfiStructToInstance ( IN EFI_REST_JSON_STRUCTURE_PROTOCOL This,
IN REST_JSON_STRUCTURE_INSTANCE InterpreterInstance,
IN EFI_REST_JSON_STRUCTURE_HEADER RestJSonHeader,
OUT CHAR8 **  ResourceRaw 
)

This function converts JSON C structure to JSON property.

Parameters
[in]ThisEFI_REST_JSON_STRUCTURE_PROTOCOL instance.
[in]InterpreterInstanceREST_JSON_STRUCTURE_INSTANCE
[in]RestJSonHeaderResource type identifier.
[out]ResourceRawOutput in JSON text format.
Return values
EFI_SUCCESS
Others.

Definition at line 260 of file RestJsonStructureDxe.c.

◆ InterpreterInstanceDestoryJsonStruct()

EFI_STATUS InterpreterInstanceDestoryJsonStruct ( IN EFI_REST_JSON_STRUCTURE_PROTOCOL This,
IN REST_JSON_STRUCTURE_INSTANCE InterpreterInstance,
IN EFI_REST_JSON_STRUCTURE_HEADER RestJSonHeader 
)

This function destory REST property structure.

Parameters
[in]ThisEFI_REST_JSON_STRUCTURE_PROTOCOL instance.
[in]InterpreterInstanceREST_JSON_STRUCTURE_INSTANCE
[in]RestJSonHeaderProperty interpreted from given ResourceRaw.
Return values
EFI_SUCCESS
Others.

Definition at line 356 of file RestJsonStructureDxe.c.

◆ InterpreterInstanceToStruct()

EFI_STATUS InterpreterInstanceToStruct ( IN EFI_REST_JSON_STRUCTURE_PROTOCOL This,
IN REST_JSON_STRUCTURE_INSTANCE InterpreterInstance,
IN EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *RsrcTypeIdentifier  OPTIONAL,
IN CHAR8 *  ResourceRaw,
OUT EFI_REST_JSON_STRUCTURE_HEADER **  RestJSonHeader 
)

This function check if this interpreter instance support the given namesapce.

Parameters
[in]ThisEFI_REST_JSON_STRUCTURE_PROTOCOL instance.
[in]InterpreterInstanceREST_JSON_STRUCTURE_INSTANCE
[in]RsrcTypeIdentifierResource type identifier.
[in]ResourceRawGiven Restful resource.
[out]RestJSonHeaderProperty interpreted from given ResourceRaw.
Return values
EFI_SUCCESS
Others.

Definition at line 124 of file RestJsonStructureDxe.c.

◆ RestJsonStructureDestroyStruct()

EFI_STATUS EFIAPI RestJsonStructureDestroyStruct ( IN EFI_REST_JSON_STRUCTURE_PROTOCOL This,
IN EFI_REST_JSON_STRUCTURE_HEADER RestJSonHeader 
)

This function destory REST property EFI structure which returned in JsonToStructure().

Parameters
[in]ThisEFI_REST_JSON_STRUCTURE_PROTOCOL instance.
[in]RestJSonHeaderProperty to destory.
Return values
EFI_SUCCESS
Others

Definition at line 535 of file RestJsonStructureDxe.c.

◆ RestJsonStructureEntryPoint()

EFI_STATUS EFIAPI RestJsonStructureEntryPoint ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

This is the declaration of an EFI image entry point.

Parameters
ImageHandleThe firmware allocated handle for the UEFI image.
SystemTableA pointer to the EFI System Table.
Return values
EFI_SUCCESSThe operation completed successfully.
OthersAn unexpected error occurred.

Definition at line 656 of file RestJsonStructureDxe.c.

◆ RestJsonStructureRegister()

EFI_STATUS EFIAPI RestJsonStructureRegister ( 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 
)

This function registers Restful resource interpreter for the specific schema.

Parameters
[in]ThisThis is the EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
[in]JsonStructureSupportedThe type and version of REST JSON resource which this converter supports.
[in]ToStructureThe function to convert REST JSON resource to structure.
[in]ToJsonThe function to convert REST JSON structure to JSON in text format.
[in]DestroyStructureDestroy REST JSON structure returned in ToStructure() function.
Return values
EFI_SUCCESSRegister successfully.
OthersFail to register.

Definition at line 38 of file RestJsonStructureDxe.c.

◆ RestJsonStructureToJson()

EFI_STATUS EFIAPI RestJsonStructureToJson ( IN EFI_REST_JSON_STRUCTURE_PROTOCOL This,
IN EFI_REST_JSON_STRUCTURE_HEADER RestJSonHeader,
OUT CHAR8 **  ResourceRaw 
)

This function translates the given JSON C Structure to JSON text.

Parameters
[in]ThisEFI_REST_JSON_STRUCTURE_PROTOCOL instance.
[in]RestJSonHeaderGiven Restful resource.
[out]ResourceRawResource in RESTfuls service oriented.
Return values
EFI_SUCCESS
OthersFail to remove the entry

Definition at line 588 of file RestJsonStructureDxe.c.

◆ RestJsonStructureToStruct()

EFI_STATUS EFIAPI RestJsonStructureToStruct ( IN EFI_REST_JSON_STRUCTURE_PROTOCOL This,
IN EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *RsrcTypeIdentifier  OPTIONAL,
IN CHAR8 *  ResourceJsonText,
OUT EFI_REST_JSON_STRUCTURE_HEADER **  JsonStructure 
)

This function translates the given JSON text to JSON C Structure.

Parameters
[in]ThisEFI_REST_JSON_STRUCTURE_PROTOCOL instance.
[in]RsrcTypeIdentifierResource type identifier.
[in]ResourceJsonTextGiven Restful resource.
[out]JsonStructureProperty interpreted from given ResourceRaw.
Return values
EFI_SUCCESS
Others.

Definition at line 444 of file RestJsonStructureDxe.c.

◆ RestJsonStructureUnload()

EFI_STATUS EFIAPI RestJsonStructureUnload ( IN EFI_HANDLE  ImageHandle)

This is the unload handle for REST JSON to C structure module.

Disconnect the driver specified by ImageHandle from all the devices in the handle database. Uninstall all the protocols installed in the driver entry point.

Parameters
[in]ImageHandleThe drivers' driver image.
Return values
EFI_SUCCESSThe image is unloaded.
OthersFailed to unload the image.

Definition at line 691 of file RestJsonStructureDxe.c.

Variable Documentation

◆ mProtocolHandle

EFI_HANDLE mProtocolHandle

Definition at line 19 of file RestJsonStructureDxe.c.

◆ mRestJsonStructureList

LIST_ENTRY mRestJsonStructureList

Definition at line 18 of file RestJsonStructureDxe.c.

◆ mRestJsonStructureProtocol

EFI_REST_JSON_STRUCTURE_PROTOCOL mRestJsonStructureProtocol
Initial value:
= {
}
EFI_STATUS EFIAPI RestJsonStructureRegister(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_STATUS EFIAPI RestJsonStructureToStruct(IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This, IN EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *RsrcTypeIdentifier OPTIONAL, IN CHAR8 *ResourceJsonText, OUT EFI_REST_JSON_STRUCTURE_HEADER **JsonStructure)
EFI_STATUS EFIAPI RestJsonStructureToJson(IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This, IN EFI_REST_JSON_STRUCTURE_HEADER *RestJSonHeader, OUT CHAR8 **ResourceRaw)
EFI_STATUS EFIAPI RestJsonStructureDestroyStruct(IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This, IN EFI_REST_JSON_STRUCTURE_HEADER *RestJSonHeader)

Definition at line 638 of file RestJsonStructureDxe.c.