* [edk2-redfish-client][PATCH] RedfishClientPkg: Update Redfish converter lib
@ 2023-05-11 0:57 Chang, Abner
2023-05-11 1:04 ` Nickle Wang
0 siblings, 1 reply; 2+ messages in thread
From: Chang, Abner @ 2023-05-11 0:57 UTC (permalink / raw)
To: devel; +Cc: Nickle Wang, Igor Kulchytskyy
From: Abner Chang <abner.chang@amd.com>
Temporary modified on the auto-generated lib to support
Redfish BIOS attributes. RedfishScemaToCStructure python
script needs to be updated for fixing this issue.
Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
---
.../src/Bios/Bios.V1_0_9/Bios.V1_0_9.c | 1118 ++++++++---------
1 file changed, 559 insertions(+), 559 deletions(-)
diff --git a/RedfishClientPkg/ConverterLib/src/Bios/Bios.V1_0_9/Bios.V1_0_9.c b/RedfishClientPkg/ConverterLib/src/Bios/Bios.V1_0_9/Bios.V1_0_9.c
index d698321886..c1418c634d 100644
--- a/RedfishClientPkg/ConverterLib/src/Bios/Bios.V1_0_9/Bios.V1_0_9.c
+++ b/RedfishClientPkg/ConverterLib/src/Bios/Bios.V1_0_9/Bios.V1_0_9.c
@@ -1,559 +1,559 @@
-//
-// Auto-generated file by Redfish Schema C Structure Generator.
-// https://github.com/DMTF/Redfish-Schema-C-Struct-Generator.
-//
-// (C) Copyright 2019-2022 Hewlett Packard Enterprise Development LP<BR>
-//
-// Copyright Notice:
-// Copyright 2019-2022 Distributed Management Task Force, Inc. All rights reserved.
-// License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/Redfish-JSON-C-Struct-Converter/blob/master/LICENSE.md
-//
-
-#include"Redfish_Bios_v1_0_9_CS.h"
-#include <stdlib.h>
-#include <string.h>
-#include <jansson.h>
-
-RedfishCS_bool SupportedRedfishResource (RedfishCS_char *Odata_Type, RedfishCS_char *NameSpace, RedfishCS_char *Version, RedfishCS_char *DataType);
-RedfishCS_status CreateCsUriByNode (RedfishCS_void *Cs, json_t *JsonOj, RedfishCS_char *NodeName, RedfishCS_char *ParentUri, RedfishCS_Type_Uri_Data **CsTypeUriData);
-RedfishCS_status CreateCsJsonByNode (RedfishCS_void *Cs, json_t *JsonOj, RedfishCS_char *NodeName, RedfishCS_char *ParentUri, RedfishCS_Type_JSON_Data **CsTypeJsonData);
-RedfishCS_status CreateCsUriOrJsonByNode (RedfishCS_void *Cs, json_t *JsonObj, RedfishCS_char *NodeName, RedfishCS_char *ParentUri, RedfishCS_Link *LinkHead);
-RedfishCS_status CreateCsUriOrJsonByNodeArray (RedfishCS_void *Cs, json_t *JsonObj, RedfishCS_char *NodeName, RedfishCS_char *ParentUri, RedfishCS_Link *LinkHead);
-RedfishCS_status CreateJsonPayloadAndCs (char *JsonRawText, char *ResourceType, char *ResourceVersion, char *TypeName, json_t **JsonObjReturned, void **Cs, int size);
-RedfishCS_status GetRedfishPropertyStr (RedfishCS_void *Cs, json_t *JsonObj, char *Key, RedfishCS_char **DstBuffer);
-RedfishCS_status GetRedfishPropertyBoolean (RedfishCS_void *Cs, json_t *JsonObj, char *Key, RedfishCS_bool **DstBuffer);
-RedfishCS_status GetRedfishPropertyVague (RedfishCS_void *Cs, json_t *JsonObj, char *Key, RedfishCS_Vague **DstBuffer);
-RedfishCS_status DestoryCsMemory (RedfishCS_void *rootCs);
-RedfishCS_status GetRedfishPropertyInt64 (RedfishCS_void *Cs, json_t *JsonObj, char *Key, RedfishCS_int64 **Dst);
-RedfishCS_status InsertJsonStringObj (json_t *JsonObj, char *Key, char *StringValue);
-RedfishCS_status InsertJsonLinkObj (json_t *JsonObj, char *Key, RedfishCS_Link *Link);
-RedfishCS_status InsertJsonInt64Obj (json_t *ParentJsonObj, char *Key, RedfishCS_int64 *Int64Value);
-RedfishCS_status InsertJsonBoolObj (json_t *ParentJsonObj, char *Key, RedfishCS_bool *BoolValue);
-RedfishCS_status InsertJsonStringArrayObj (json_t *JsonObj, char *Key, RedfishCS_char_Array *StringValueArray);
-RedfishCS_status InsertJsonLinkArrayObj (json_t *JsonObj, char *Key, RedfishCS_Link *LinkArray);
-RedfishCS_status InsertJsonInt64ArrayObj (json_t *ParentJsonObj, char *Key, RedfishCS_int64_Array *Int64ValueArray);
-RedfishCS_status InsertJsonBoolArrayObj (json_t *ParentJsonObj, char *Key, RedfishCS_bool_Array *BoolValueArray);
-RedfishCS_status InsertJsonVagueObj (json_t *ParentJsonObj, char *Key, RedfishCS_Vague *VagueValue);
-RedfishCS_bool CheckEmptyPropJsonObject(json_t *JsonObj, RedfishCS_uint32 *NumOfProperty);
-RedfishCS_status CreateEmptyPropCsJson(RedfishCS_void *Cs, json_t *JsonOj, RedfishCS_char *NodeName, RedfishCS_char *ParentUri, RedfishCS_Type_EmptyProp_CS_Data **CsTypeEmptyPropCS, RedfishCS_uint32 NunmOfProperties);
-RedfishCS_status CsEmptyPropLinkToJson(json_t *CsJson, char *Key, RedfishCS_Link *Link);
-
-//
-//Generate C structure for #Bios.ChangePassword
-//
-static RedfishCS_status GenChangePasswordCs(RedfishBios_V1_0_9_Bios_CS *Cs, json_t *JsonObj, char *Key, RedfishBios_V1_0_9_ChangePassword_CS **Dst)
-{
- RedfishCS_status Status;
- json_t *TempJsonObj;
-
- Status = RedfishCS_status_success;
- TempJsonObj = json_object_get(JsonObj, Key);
- if (TempJsonObj == NULL) {
- return RedfishCS_status_not_found;
- }
- Status = allocateRecordCsMemory(Cs, sizeof(RedfishBios_V1_0_9_ChangePassword_CS), (RedfishCS_void **)Dst);
- if (Status != RedfishCS_status_success){
- goto Error;
- }
- // target
- Status = GetRedfishPropertyStr (Cs, TempJsonObj, "target", &(*Dst)->target);
- if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
- else {if (Status == RedfishCS_status_not_found){/*This is not the required property.*/}}
-
- // title
- Status = GetRedfishPropertyStr (Cs, TempJsonObj, "title", &(*Dst)->title);
- if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
- else {if (Status == RedfishCS_status_not_found){/*This is not the required property.*/}}
-
-Error:;
- return Status;
-}
-//
-//Generate C structure for #Bios.ResetBios
-//
-static RedfishCS_status GenResetBiosCs(RedfishBios_V1_0_9_Bios_CS *Cs, json_t *JsonObj, char *Key, RedfishBios_V1_0_9_ResetBios_CS **Dst)
-{
- RedfishCS_status Status;
- json_t *TempJsonObj;
-
- Status = RedfishCS_status_success;
- TempJsonObj = json_object_get(JsonObj, Key);
- if (TempJsonObj == NULL) {
- return RedfishCS_status_not_found;
- }
- Status = allocateRecordCsMemory(Cs, sizeof(RedfishBios_V1_0_9_ResetBios_CS), (RedfishCS_void **)Dst);
- if (Status != RedfishCS_status_success){
- goto Error;
- }
- // target
- Status = GetRedfishPropertyStr (Cs, TempJsonObj, "target", &(*Dst)->target);
- if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
- else {if (Status == RedfishCS_status_not_found){/*This is not the required property.*/}}
-
- // title
- Status = GetRedfishPropertyStr (Cs, TempJsonObj, "title", &(*Dst)->title);
- if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
- else {if (Status == RedfishCS_status_not_found){/*This is not the required property.*/}}
-
-Error:;
- return Status;
-}
-//
-//Generate C structure for Oem
-//
-static RedfishCS_status GenOemActionsCs(RedfishBios_V1_0_9_Bios_CS *Cs, json_t *JsonObj, char *Key, RedfishBios_V1_0_9_OemActions_CS **Dst)
-{
- RedfishCS_status Status;
- RedfishCS_Type_JSON_Data *CsTypeJson;
- RedfishCS_Type_EmptyProp_CS_Data *CsTypeEmptyPropCS;
- RedfishCS_uint32 NunmOfEmptyPropProperties;
- json_t *TempJsonObj;
-
- Status = RedfishCS_status_success;
- TempJsonObj = json_object_get(JsonObj, Key);
- if (TempJsonObj == NULL) {
- return RedfishCS_status_not_found;
- }
- Status = allocateRecordCsMemory(Cs, sizeof(RedfishBios_V1_0_9_OemActions_CS), (RedfishCS_void **)Dst);
- if (Status != RedfishCS_status_success){
- goto Error;
- }
- InitializeLinkHead (&(*Dst)->Prop);
-
- //
- // Try to create C structure if the property is
- // declared as empty property in schema. The supported property type
- // is string, integer, real, number and boolean.
- //
- if (CheckEmptyPropJsonObject(TempJsonObj, &NunmOfEmptyPropProperties)) {
- Status = CreateEmptyPropCsJson(Cs, JsonObj, Key, Cs->Header.ThisUri, &CsTypeEmptyPropCS, NunmOfEmptyPropProperties);
- if (Status != RedfishCS_status_success) {
- goto Error;
- }
- InsertTailLink(&(*Dst)->Prop, &CsTypeEmptyPropCS->Header.LinkEntry);
- } else {
- Status = CreateCsJsonByNode (Cs, JsonObj, Key, Cs->Header.ThisUri, &CsTypeJson);
- if (Status != RedfishCS_status_success) {
- goto Error;
- }
- InsertTailLink(&(*Dst)->Prop, &CsTypeJson->Header.LinkEntry);
- }
-Error:;
- return Status;
-}
-//
-//Generate C structure for Actions
-//
-static RedfishCS_status GenActionsCs(RedfishBios_V1_0_9_Bios_CS *Cs, json_t *JsonObj, char *Key, RedfishBios_V1_0_9_Actions_CS **Dst)
-{
- RedfishCS_status Status;
- json_t *TempJsonObj;
-
- Status = RedfishCS_status_success;
- TempJsonObj = json_object_get(JsonObj, Key);
- if (TempJsonObj == NULL) {
- return RedfishCS_status_not_found;
- }
- Status = allocateRecordCsMemory(Cs, sizeof(RedfishBios_V1_0_9_Actions_CS), (RedfishCS_void **)Dst);
- if (Status != RedfishCS_status_success){
- goto Error;
- }
- // #Bios.ChangePassword
- Status = GenChangePasswordCs (Cs, TempJsonObj, "#Bios.ChangePassword", &(*Dst)->Bios_ChangePassword);
- if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
- else {if (Status == RedfishCS_status_not_found){/*This is not the required property.*/}}
-
- // #Bios.ResetBios
- Status = GenResetBiosCs (Cs, TempJsonObj, "#Bios.ResetBios", &(*Dst)->Bios_ResetBios);
- if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
- else {if (Status == RedfishCS_status_not_found){/*This is not the required property.*/}}
-
- // Oem
- Status = GenOemActionsCs (Cs, TempJsonObj, "Oem", &(*Dst)->Oem);
- if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
- else {if (Status == RedfishCS_status_not_found){/*This is not the required property.*/}}
-
-Error:;
- return Status;
-}
-//
-//Generate C structure for Attributes
-//
-static RedfishCS_status GenAttributesCs(RedfishBios_V1_0_9_Bios_CS *Cs, json_t *JsonObj, char *Key, RedfishBios_V1_0_9_Attributes_CS **Dst)
-{
- RedfishCS_status Status;
- RedfishCS_Type_JSON_Data *CsTypeJson;
- RedfishCS_Type_EmptyProp_CS_Data *CsTypeEmptyPropCS;
- RedfishCS_uint32 NunmOfEmptyPropProperties;
- json_t *TempJsonObj;
-
- Status = RedfishCS_status_success;
- TempJsonObj = json_object_get(JsonObj, Key);
- if (TempJsonObj == NULL) {
- return RedfishCS_status_not_found;
- }
- Status = allocateRecordCsMemory(Cs, sizeof(RedfishBios_V1_0_9_Attributes_CS), (RedfishCS_void **)Dst);
- if (Status != RedfishCS_status_success){
- goto Error;
- }
- InitializeLinkHead (&(*Dst)->Prop);
-
- //
- // Try to create C structure if the property is
- // declared as empty property in schema. The supported property type
- // is string, integer, real, number and boolean.
- //
- if (CheckEmptyPropJsonObject(TempJsonObj, &NunmOfEmptyPropProperties)) {
- Status = CreateEmptyPropCsJson(Cs, JsonObj, Key, Cs->Header.ThisUri, &CsTypeEmptyPropCS, NunmOfEmptyPropProperties);
- if (Status != RedfishCS_status_success) {
- goto Error;
- }
- InsertTailLink(&(*Dst)->Prop, &CsTypeEmptyPropCS->Header.LinkEntry);
- } else {
- Status = CreateCsJsonByNode (Cs, JsonObj, Key, Cs->Header.ThisUri, &CsTypeJson);
- if (Status != RedfishCS_status_success) {
- goto Error;
- }
- InsertTailLink(&(*Dst)->Prop, &CsTypeJson->Header.LinkEntry);
- }
-Error:;
- return Status;
-}
-//
-//Generate C structure for Oem
-//
-static RedfishCS_status GenOemCs(RedfishBios_V1_0_9_Bios_CS *Cs, json_t *JsonObj, char *Key, RedfishResource_Oem_CS **Dst)
-{
- RedfishCS_status Status;
- RedfishCS_Type_JSON_Data *CsTypeJson;
- RedfishCS_Type_EmptyProp_CS_Data *CsTypeEmptyPropCS;
- RedfishCS_uint32 NunmOfEmptyPropProperties;
- json_t *TempJsonObj;
-
- Status = RedfishCS_status_success;
- TempJsonObj = json_object_get(JsonObj, Key);
- if (TempJsonObj == NULL) {
- return RedfishCS_status_not_found;
- }
- Status = allocateRecordCsMemory(Cs, sizeof(RedfishResource_Oem_CS), (RedfishCS_void **)Dst);
- if (Status != RedfishCS_status_success){
- goto Error;
- }
- InitializeLinkHead (&(*Dst)->Prop);
-
- //
- // Try to create C structure if the property is
- // declared as empty property in schema. The supported property type
- // is string, integer, real, number and boolean.
- //
- if (CheckEmptyPropJsonObject(TempJsonObj, &NunmOfEmptyPropProperties)) {
- Status = CreateEmptyPropCsJson(Cs, JsonObj, Key, Cs->Header.ThisUri, &CsTypeEmptyPropCS, NunmOfEmptyPropProperties);
- if (Status != RedfishCS_status_success) {
- goto Error;
- }
- InsertTailLink(&(*Dst)->Prop, &CsTypeEmptyPropCS->Header.LinkEntry);
- } else {
- Status = CreateCsJsonByNode (Cs, JsonObj, Key, Cs->Header.ThisUri, &CsTypeJson);
- if (Status != RedfishCS_status_success) {
- goto Error;
- }
- InsertTailLink(&(*Dst)->Prop, &CsTypeJson->Header.LinkEntry);
- }
-Error:;
- return Status;
-}
-static RedfishCS_status CS_To_JSON_ActionsBios_ChangePassword(json_t *CsJson, char *Key, RedfishBios_V1_0_9_ChangePassword_CS *CSPtr)
-{
- json_t *CsParentJson;
-
- if (CSPtr == NULL) {
- return RedfishCS_status_success;
- }
-
- CsParentJson = CsJson;
- CsJson = json_object();
- if (CsJson == NULL) {
- return RedfishCS_status_unsupported;
- }
-
- // target
- if (InsertJsonStringObj (CsJson, "target", CSPtr->target) != RedfishCS_status_success) {goto Error;}
-
- // title
- if (InsertJsonStringObj (CsJson, "title", CSPtr->title) != RedfishCS_status_success) {goto Error;}
-
- // Set to parent JSON object.
- if (json_object_set_new (CsParentJson, Key, CsJson) == -1) {goto Error;}
-
- return RedfishCS_status_success;
-Error:;
- return RedfishCS_status_unsupported;
-}
-static RedfishCS_status CS_To_JSON_ActionsBios_ResetBios(json_t *CsJson, char *Key, RedfishBios_V1_0_9_ResetBios_CS *CSPtr)
-{
- json_t *CsParentJson;
-
- if (CSPtr == NULL) {
- return RedfishCS_status_success;
- }
-
- CsParentJson = CsJson;
- CsJson = json_object();
- if (CsJson == NULL) {
- return RedfishCS_status_unsupported;
- }
-
- // target
- if (InsertJsonStringObj (CsJson, "target", CSPtr->target) != RedfishCS_status_success) {goto Error;}
-
- // title
- if (InsertJsonStringObj (CsJson, "title", CSPtr->title) != RedfishCS_status_success) {goto Error;}
-
- // Set to parent JSON object.
- if (json_object_set_new (CsParentJson, Key, CsJson) == -1) {goto Error;}
-
- return RedfishCS_status_success;
-Error:;
- return RedfishCS_status_unsupported;
-}
-static RedfishCS_status CS_To_JSON_ActionsOem(json_t *CsJson, char *Key, RedfishBios_V1_0_9_OemActions_CS *CSPtr)
-{
- json_t *CsParentJson;
-
- if (CSPtr == NULL) {
- return RedfishCS_status_success;
- }
-
- CsParentJson = CsJson;
- CsJson = json_object();
- if (CsJson == NULL) {
- return RedfishCS_status_unsupported;
- }
-
- // Check if this is RedfishCS_Type_CS_EmptyProp.
- CsEmptyPropLinkToJson(CsJson, Key, &CSPtr->Prop);
- // No JSON property for this structure.
- return RedfishCS_status_success;
-}
-static RedfishCS_status CS_To_JSON_Actions(json_t *CsJson, char *Key, RedfishBios_V1_0_9_Actions_CS *CSPtr)
-{
- json_t *CsParentJson;
-
- if (CSPtr == NULL) {
- return RedfishCS_status_success;
- }
-
- CsParentJson = CsJson;
- CsJson = json_object();
- if (CsJson == NULL) {
- return RedfishCS_status_unsupported;
- }
-
- // #Bios.ChangePassword
- if (CS_To_JSON_ActionsBios_ChangePassword(CsJson, "#Bios.ChangePassword", CSPtr->Bios_ChangePassword) != RedfishCS_status_success) {goto Error;}
-
- // #Bios.ResetBios
- if (CS_To_JSON_ActionsBios_ResetBios(CsJson, "#Bios.ResetBios", CSPtr->Bios_ResetBios) != RedfishCS_status_success) {goto Error;}
-
- // Oem
- if (CS_To_JSON_ActionsOem(CsJson, "Oem", CSPtr->Oem) != RedfishCS_status_success) {goto Error;}
-
- // Set to parent JSON object.
- if (json_object_set_new (CsParentJson, Key, CsJson) == -1) {goto Error;}
-
- return RedfishCS_status_success;
-Error:;
- return RedfishCS_status_unsupported;
-}
-static RedfishCS_status CS_To_JSON_Attributes(json_t *CsJson, char *Key, RedfishBios_V1_0_9_Attributes_CS *CSPtr)
-{
- json_t *CsParentJson;
-
- if (CSPtr == NULL) {
- return RedfishCS_status_success;
- }
-
- CsParentJson = CsJson;
- CsJson = json_object();
- if (CsJson == NULL) {
- return RedfishCS_status_unsupported;
- }
-
- // Check if this is RedfishCS_Type_CS_EmptyProp.
- CsEmptyPropLinkToJson(CsJson, Key, &CSPtr->Prop);
- // No JSON property for this structure.
- return RedfishCS_status_success;
-}
-static RedfishCS_status CS_To_JSON_Oem(json_t *CsJson, char *Key, RedfishResource_Oem_CS *CSPtr)
-{
- json_t *CsParentJson;
-
- if (CSPtr == NULL) {
- return RedfishCS_status_success;
- }
-
- CsParentJson = CsJson;
- CsJson = json_object();
- if (CsJson == NULL) {
- return RedfishCS_status_unsupported;
- }
-
- // Check if this is RedfishCS_Type_CS_EmptyProp.
- CsEmptyPropLinkToJson(CsJson, Key, &CSPtr->Prop);
- // No JSON property for this structure.
- return RedfishCS_status_success;
-}
-
-//
-// C structure to JSON for Bios.V1_0_9.Bios
-//
-RedfishCS_status CS_To_Bios_V1_0_9_JSON(RedfishBios_V1_0_9_Bios_CS *CSPtr, RedfishCS_char **JsonText)
-{
- json_t *CsJson;
-
- if (CSPtr == NULL || JsonText == NULL || CSPtr->Header.ResourceType != RedfishCS_Type_CS) {
- return RedfishCS_status_invalid_parameter;
- }
- CsJson = json_object();
- if (CsJson == NULL) {
- return RedfishCS_status_unsupported;
- }
- // Actions
- if (CS_To_JSON_Actions(CsJson, "Actions", CSPtr->Actions) != RedfishCS_status_success) {goto Error;}
-
- // AttributeRegistry
- if (InsertJsonStringObj (CsJson, "AttributeRegistry", CSPtr->AttributeRegistry) != RedfishCS_status_success) {goto Error;}
-
- // Attributes
- if (CS_To_JSON_Attributes(CsJson, "Attributes", CSPtr->Attributes) != RedfishCS_status_success) {goto Error;}
-
- // Description
- if (InsertJsonStringObj (CsJson, "Description", CSPtr->Description) != RedfishCS_status_success) {goto Error;}
-
- // Id
- if (InsertJsonStringObj (CsJson, "Id", CSPtr->Id) != RedfishCS_status_success) {goto Error;}
-
- // Name
- if (InsertJsonStringObj (CsJson, "Name", CSPtr->Name) != RedfishCS_status_success) {goto Error;}
-
- // Oem
- if (CS_To_JSON_Oem(CsJson, "Oem", CSPtr->Oem) != RedfishCS_status_success) {goto Error;}
-
- // @odata.context
- if (InsertJsonStringObj (CsJson, "@odata.context", CSPtr->odata_context) != RedfishCS_status_success) {goto Error;}
-
- // @odata.etag
- if (InsertJsonStringObj (CsJson, "@odata.etag", CSPtr->odata_etag) != RedfishCS_status_success) {goto Error;}
-
- // @odata.id
- if (InsertJsonStringObj (CsJson, "@odata.id", CSPtr->odata_id) != RedfishCS_status_success) {goto Error;}
-
- // @odata.type
- if (InsertJsonStringObj (CsJson, "@odata.type", CSPtr->odata_type) != RedfishCS_status_success) {goto Error;}
-
- *JsonText = (RedfishCS_char *)json_dumps(CsJson, JSON_INDENT(2 * 1) | JSON_ENSURE_ASCII);
- json_decref(CsJson);
- return RedfishCS_status_success;
-Error:;
- json_decref(CsJson);
- return RedfishCS_status_unsupported;
-}
-
-//
-// Destory C Structure for Bios.V1_0_9.Bios
-//
-RedfishCS_status DestroyBios_V1_0_9_CS(RedfishBios_V1_0_9_Bios_CS *CSPtr)
-{
- RedfishCS_status Status;
-
- Status = DestoryCsMemory ((RedfishCS_void *)CSPtr);
- return Status;
-}
-
-//
-// Destory JSON text for Bios.V1_0_9.Bios
-//
-RedfishCS_status DestroyBios_V1_0_9_Json(RedfishCS_char *JsonText)
-{
- free ((RedfishCS_void *)JsonText);
- return RedfishCS_status_success;
-}
-
-//
-//Generate C structure for Bios.V1_0_9.Bios
-//
-RedfishCS_status
-Json_Bios_V1_0_9_To_CS(RedfishCS_char *JsonRawText, RedfishBios_V1_0_9_Bios_CS **ReturnedCs)
-{
- RedfishCS_status Status;
- json_t *JsonObj;
- RedfishBios_V1_0_9_Bios_CS *Cs;
-
- Status = CreateJsonPayloadAndCs (JsonRawText, "Bios", "v1_0_9", "Bios", &JsonObj, (RedfishCS_void **)&Cs, sizeof (RedfishBios_V1_0_9_Bios_CS));
- if (Status != RedfishCS_status_success) {
- goto Error;
- }
-
- // @odata.context
- Status = GetRedfishPropertyStr (Cs, JsonObj, "@odata.context", &Cs->odata_context);
- if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
- else {if (Status == RedfishCS_status_not_found){/*This is not the required property.*/}}
-
- // @odata.etag
- Status = GetRedfishPropertyStr (Cs, JsonObj, "@odata.etag", &Cs->odata_etag);
- if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
- else {if (Status == RedfishCS_status_not_found){/*This is not the required property.*/}}
-
- // @odata.id
- Status = GetRedfishPropertyStr (Cs, JsonObj, "@odata.id", &Cs->odata_id);
- if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
- else {if (Status == RedfishCS_status_not_found){goto Error;}}
-
- // @odata.type
- Status = GetRedfishPropertyStr (Cs, JsonObj, "@odata.type", &Cs->odata_type);
- if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
- else {if (Status == RedfishCS_status_not_found){goto Error;}}
-
- // Actions
- Status = GenActionsCs (Cs, JsonObj, "Actions", &Cs->Actions);
- if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
- else {if (Status == RedfishCS_status_not_found){/*This is not the required property.*/}}
-
- // AttributeRegistry
- Status = GetRedfishPropertyStr (Cs, JsonObj, "AttributeRegistry", &Cs->AttributeRegistry);
- if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
- else {if (Status == RedfishCS_status_not_found){/*This is not the required property.*/}}
-
- // Attributes
- Status = GenAttributesCs (Cs, JsonObj, "Attributes", &Cs->Attributes);
- if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
- else {if (Status == RedfishCS_status_not_found){/*This is not the required property.*/}}
-
- // Description
- Status = GetRedfishPropertyStr (Cs, JsonObj, "Description", &Cs->Description);
- if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
- else {if (Status == RedfishCS_status_not_found){/*This is not the required property.*/}}
-
- // Id
- Status = GetRedfishPropertyStr (Cs, JsonObj, "Id", &Cs->Id);
- if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
- else {if (Status == RedfishCS_status_not_found){goto Error;}}
-
- // Name
- Status = GetRedfishPropertyStr (Cs, JsonObj, "Name", &Cs->Name);
- if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
- else {if (Status == RedfishCS_status_not_found){goto Error;}}
-
- // Oem
- Status = GenOemCs (Cs, JsonObj, "Oem", &Cs->Oem);
- if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
- else {if (Status == RedfishCS_status_not_found){/*This is not the required property.*/}}
-
- json_decref(JsonObj);
- *ReturnedCs = Cs;
- return RedfishCS_status_success;
-Error:;
- json_decref(JsonObj);
- DestroyBios_V1_0_9_CS (Cs);
- return Status;
-}
+//
+// Auto-generated file by Redfish Schema C Structure Generator.
+// https://github.com/DMTF/Redfish-Schema-C-Struct-Generator.
+//
+// (C) Copyright 2019-2022 Hewlett Packard Enterprise Development LP<BR>
+//
+// Copyright Notice:
+// Copyright 2019-2022 Distributed Management Task Force, Inc. All rights reserved.
+// License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/Redfish-JSON-C-Struct-Converter/blob/master/LICENSE.md
+//
+
+#include"Redfish_Bios_v1_0_9_CS.h"
+#include <stdlib.h>
+#include <string.h>
+#include <jansson.h>
+
+RedfishCS_bool SupportedRedfishResource (RedfishCS_char *Odata_Type, RedfishCS_char *NameSpace, RedfishCS_char *Version, RedfishCS_char *DataType);
+RedfishCS_status CreateCsUriByNode (RedfishCS_void *Cs, json_t *JsonOj, RedfishCS_char *NodeName, RedfishCS_char *ParentUri, RedfishCS_Type_Uri_Data **CsTypeUriData);
+RedfishCS_status CreateCsJsonByNode (RedfishCS_void *Cs, json_t *JsonOj, RedfishCS_char *NodeName, RedfishCS_char *ParentUri, RedfishCS_Type_JSON_Data **CsTypeJsonData);
+RedfishCS_status CreateCsUriOrJsonByNode (RedfishCS_void *Cs, json_t *JsonObj, RedfishCS_char *NodeName, RedfishCS_char *ParentUri, RedfishCS_Link *LinkHead);
+RedfishCS_status CreateCsUriOrJsonByNodeArray (RedfishCS_void *Cs, json_t *JsonObj, RedfishCS_char *NodeName, RedfishCS_char *ParentUri, RedfishCS_Link *LinkHead);
+RedfishCS_status CreateJsonPayloadAndCs (char *JsonRawText, char *ResourceType, char *ResourceVersion, char *TypeName, json_t **JsonObjReturned, void **Cs, int size);
+RedfishCS_status GetRedfishPropertyStr (RedfishCS_void *Cs, json_t *JsonObj, char *Key, RedfishCS_char **DstBuffer);
+RedfishCS_status GetRedfishPropertyBoolean (RedfishCS_void *Cs, json_t *JsonObj, char *Key, RedfishCS_bool **DstBuffer);
+RedfishCS_status GetRedfishPropertyVague (RedfishCS_void *Cs, json_t *JsonObj, char *Key, RedfishCS_Vague **DstBuffer);
+RedfishCS_status DestoryCsMemory (RedfishCS_void *rootCs);
+RedfishCS_status GetRedfishPropertyInt64 (RedfishCS_void *Cs, json_t *JsonObj, char *Key, RedfishCS_int64 **Dst);
+RedfishCS_status InsertJsonStringObj (json_t *JsonObj, char *Key, char *StringValue);
+RedfishCS_status InsertJsonLinkObj (json_t *JsonObj, char *Key, RedfishCS_Link *Link);
+RedfishCS_status InsertJsonInt64Obj (json_t *ParentJsonObj, char *Key, RedfishCS_int64 *Int64Value);
+RedfishCS_status InsertJsonBoolObj (json_t *ParentJsonObj, char *Key, RedfishCS_bool *BoolValue);
+RedfishCS_status InsertJsonStringArrayObj (json_t *JsonObj, char *Key, RedfishCS_char_Array *StringValueArray);
+RedfishCS_status InsertJsonLinkArrayObj (json_t *JsonObj, char *Key, RedfishCS_Link *LinkArray);
+RedfishCS_status InsertJsonInt64ArrayObj (json_t *ParentJsonObj, char *Key, RedfishCS_int64_Array *Int64ValueArray);
+RedfishCS_status InsertJsonBoolArrayObj (json_t *ParentJsonObj, char *Key, RedfishCS_bool_Array *BoolValueArray);
+RedfishCS_status InsertJsonVagueObj (json_t *ParentJsonObj, char *Key, RedfishCS_Vague *VagueValue);
+RedfishCS_bool CheckEmptyPropJsonObject(json_t *JsonObj, RedfishCS_uint32 *NumOfProperty);
+RedfishCS_status CreateEmptyPropCsJson(RedfishCS_void *Cs, json_t *JsonOj, RedfishCS_char *NodeName, RedfishCS_char *ParentUri, RedfishCS_Type_EmptyProp_CS_Data **CsTypeEmptyPropCS, RedfishCS_uint32 NunmOfProperties);
+RedfishCS_status CsEmptyPropLinkToJson(json_t *CsJson, char *Key, RedfishCS_Link *Link);
+
+//
+//Generate C structure for #Bios.ChangePassword
+//
+static RedfishCS_status GenChangePasswordCs(RedfishBios_V1_0_9_Bios_CS *Cs, json_t *JsonObj, char *Key, RedfishBios_V1_0_9_ChangePassword_CS **Dst)
+{
+ RedfishCS_status Status;
+ json_t *TempJsonObj;
+
+ Status = RedfishCS_status_success;
+ TempJsonObj = json_object_get(JsonObj, Key);
+ if (TempJsonObj == NULL) {
+ return RedfishCS_status_not_found;
+ }
+ Status = allocateRecordCsMemory(Cs, sizeof(RedfishBios_V1_0_9_ChangePassword_CS), (RedfishCS_void **)Dst);
+ if (Status != RedfishCS_status_success){
+ goto Error;
+ }
+ // target
+ Status = GetRedfishPropertyStr (Cs, TempJsonObj, "target", &(*Dst)->target);
+ if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
+ else {if (Status == RedfishCS_status_not_found){/*This is not the required property.*/}}
+
+ // title
+ Status = GetRedfishPropertyStr (Cs, TempJsonObj, "title", &(*Dst)->title);
+ if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
+ else {if (Status == RedfishCS_status_not_found){/*This is not the required property.*/}}
+
+Error:;
+ return Status;
+}
+//
+//Generate C structure for #Bios.ResetBios
+//
+static RedfishCS_status GenResetBiosCs(RedfishBios_V1_0_9_Bios_CS *Cs, json_t *JsonObj, char *Key, RedfishBios_V1_0_9_ResetBios_CS **Dst)
+{
+ RedfishCS_status Status;
+ json_t *TempJsonObj;
+
+ Status = RedfishCS_status_success;
+ TempJsonObj = json_object_get(JsonObj, Key);
+ if (TempJsonObj == NULL) {
+ return RedfishCS_status_not_found;
+ }
+ Status = allocateRecordCsMemory(Cs, sizeof(RedfishBios_V1_0_9_ResetBios_CS), (RedfishCS_void **)Dst);
+ if (Status != RedfishCS_status_success){
+ goto Error;
+ }
+ // target
+ Status = GetRedfishPropertyStr (Cs, TempJsonObj, "target", &(*Dst)->target);
+ if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
+ else {if (Status == RedfishCS_status_not_found){/*This is not the required property.*/}}
+
+ // title
+ Status = GetRedfishPropertyStr (Cs, TempJsonObj, "title", &(*Dst)->title);
+ if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
+ else {if (Status == RedfishCS_status_not_found){/*This is not the required property.*/}}
+
+Error:;
+ return Status;
+}
+//
+//Generate C structure for Oem
+//
+static RedfishCS_status GenOemActionsCs(RedfishBios_V1_0_9_Bios_CS *Cs, json_t *JsonObj, char *Key, RedfishBios_V1_0_9_OemActions_CS **Dst)
+{
+ RedfishCS_status Status;
+ RedfishCS_Type_JSON_Data *CsTypeJson;
+ RedfishCS_Type_EmptyProp_CS_Data *CsTypeEmptyPropCS;
+ RedfishCS_uint32 NunmOfEmptyPropProperties;
+ json_t *TempJsonObj;
+
+ Status = RedfishCS_status_success;
+ TempJsonObj = json_object_get(JsonObj, Key);
+ if (TempJsonObj == NULL) {
+ return RedfishCS_status_not_found;
+ }
+ Status = allocateRecordCsMemory(Cs, sizeof(RedfishBios_V1_0_9_OemActions_CS), (RedfishCS_void **)Dst);
+ if (Status != RedfishCS_status_success){
+ goto Error;
+ }
+ InitializeLinkHead (&(*Dst)->Prop);
+
+ //
+ // Try to create C structure if the property is
+ // declared as empty property in schema. The supported property type
+ // is string, integer, real, number and boolean.
+ //
+ if (CheckEmptyPropJsonObject(TempJsonObj, &NunmOfEmptyPropProperties)) {
+ Status = CreateEmptyPropCsJson(Cs, JsonObj, Key, Cs->Header.ThisUri, &CsTypeEmptyPropCS, NunmOfEmptyPropProperties);
+ if (Status != RedfishCS_status_success) {
+ goto Error;
+ }
+ InsertTailLink(&(*Dst)->Prop, &CsTypeEmptyPropCS->Header.LinkEntry);
+ } else {
+ Status = CreateCsJsonByNode (Cs, JsonObj, Key, Cs->Header.ThisUri, &CsTypeJson);
+ if (Status != RedfishCS_status_success) {
+ goto Error;
+ }
+ InsertTailLink(&(*Dst)->Prop, &CsTypeJson->Header.LinkEntry);
+ }
+Error:;
+ return Status;
+}
+//
+//Generate C structure for Actions
+//
+static RedfishCS_status GenActionsCs(RedfishBios_V1_0_9_Bios_CS *Cs, json_t *JsonObj, char *Key, RedfishBios_V1_0_9_Actions_CS **Dst)
+{
+ RedfishCS_status Status;
+ json_t *TempJsonObj;
+
+ Status = RedfishCS_status_success;
+ TempJsonObj = json_object_get(JsonObj, Key);
+ if (TempJsonObj == NULL) {
+ return RedfishCS_status_not_found;
+ }
+ Status = allocateRecordCsMemory(Cs, sizeof(RedfishBios_V1_0_9_Actions_CS), (RedfishCS_void **)Dst);
+ if (Status != RedfishCS_status_success){
+ goto Error;
+ }
+ // #Bios.ChangePassword
+ Status = GenChangePasswordCs (Cs, TempJsonObj, "#Bios.ChangePassword", &(*Dst)->Bios_ChangePassword);
+ if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
+ else {if (Status == RedfishCS_status_not_found){/*This is not the required property.*/}}
+
+ // #Bios.ResetBios
+ Status = GenResetBiosCs (Cs, TempJsonObj, "#Bios.ResetBios", &(*Dst)->Bios_ResetBios);
+ if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
+ else {if (Status == RedfishCS_status_not_found){/*This is not the required property.*/}}
+
+ // Oem
+ Status = GenOemActionsCs (Cs, TempJsonObj, "Oem", &(*Dst)->Oem);
+ if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
+ else {if (Status == RedfishCS_status_not_found){/*This is not the required property.*/}}
+
+Error:;
+ return Status;
+}
+//
+//Generate C structure for Attributes
+//
+static RedfishCS_status GenAttributesCs(RedfishBios_V1_0_9_Bios_CS *Cs, json_t *JsonObj, char *Key, RedfishBios_V1_0_9_Attributes_CS **Dst)
+{
+ RedfishCS_status Status;
+ RedfishCS_Type_JSON_Data *CsTypeJson;
+ RedfishCS_Type_EmptyProp_CS_Data *CsTypeEmptyPropCS;
+ RedfishCS_uint32 NunmOfEmptyPropProperties;
+ json_t *TempJsonObj;
+
+ Status = RedfishCS_status_success;
+ TempJsonObj = json_object_get(JsonObj, Key);
+ if (TempJsonObj == NULL) {
+ return RedfishCS_status_not_found;
+ }
+ Status = allocateRecordCsMemory(Cs, sizeof(RedfishBios_V1_0_9_Attributes_CS), (RedfishCS_void **)Dst);
+ if (Status != RedfishCS_status_success){
+ goto Error;
+ }
+ InitializeLinkHead (&(*Dst)->Prop);
+
+ //
+ // Try to create C structure if the property is
+ // declared as empty property in schema. The supported property type
+ // is string, integer, real, number and boolean.
+ //
+ if (CheckEmptyPropJsonObject(TempJsonObj, &NunmOfEmptyPropProperties)) {
+ Status = CreateEmptyPropCsJson(Cs, JsonObj, Key, Cs->Header.ThisUri, &CsTypeEmptyPropCS, NunmOfEmptyPropProperties);
+ if (Status != RedfishCS_status_success) {
+ goto Error;
+ }
+ InsertTailLink(&(*Dst)->Prop, &CsTypeEmptyPropCS->Header.LinkEntry);
+ } else {
+ Status = CreateCsJsonByNode (Cs, JsonObj, Key, Cs->Header.ThisUri, &CsTypeJson);
+ if (Status != RedfishCS_status_success) {
+ goto Error;
+ }
+ InsertTailLink(&(*Dst)->Prop, &CsTypeJson->Header.LinkEntry);
+ }
+Error:;
+ return Status;
+}
+//
+//Generate C structure for Oem
+//
+static RedfishCS_status GenOemCs(RedfishBios_V1_0_9_Bios_CS *Cs, json_t *JsonObj, char *Key, RedfishResource_Oem_CS **Dst)
+{
+ RedfishCS_status Status;
+ RedfishCS_Type_JSON_Data *CsTypeJson;
+ RedfishCS_Type_EmptyProp_CS_Data *CsTypeEmptyPropCS;
+ RedfishCS_uint32 NunmOfEmptyPropProperties;
+ json_t *TempJsonObj;
+
+ Status = RedfishCS_status_success;
+ TempJsonObj = json_object_get(JsonObj, Key);
+ if (TempJsonObj == NULL) {
+ return RedfishCS_status_not_found;
+ }
+ Status = allocateRecordCsMemory(Cs, sizeof(RedfishResource_Oem_CS), (RedfishCS_void **)Dst);
+ if (Status != RedfishCS_status_success){
+ goto Error;
+ }
+ InitializeLinkHead (&(*Dst)->Prop);
+
+ //
+ // Try to create C structure if the property is
+ // declared as empty property in schema. The supported property type
+ // is string, integer, real, number and boolean.
+ //
+ if (CheckEmptyPropJsonObject(TempJsonObj, &NunmOfEmptyPropProperties)) {
+ Status = CreateEmptyPropCsJson(Cs, JsonObj, Key, Cs->Header.ThisUri, &CsTypeEmptyPropCS, NunmOfEmptyPropProperties);
+ if (Status != RedfishCS_status_success) {
+ goto Error;
+ }
+ InsertTailLink(&(*Dst)->Prop, &CsTypeEmptyPropCS->Header.LinkEntry);
+ } else {
+ Status = CreateCsJsonByNode (Cs, JsonObj, Key, Cs->Header.ThisUri, &CsTypeJson);
+ if (Status != RedfishCS_status_success) {
+ goto Error;
+ }
+ InsertTailLink(&(*Dst)->Prop, &CsTypeJson->Header.LinkEntry);
+ }
+Error:;
+ return Status;
+}
+static RedfishCS_status CS_To_JSON_ActionsBios_ChangePassword(json_t *CsJson, char *Key, RedfishBios_V1_0_9_ChangePassword_CS *CSPtr)
+{
+ json_t *CsParentJson;
+
+ if (CSPtr == NULL) {
+ return RedfishCS_status_success;
+ }
+
+ CsParentJson = CsJson;
+ CsJson = json_object();
+ if (CsJson == NULL) {
+ return RedfishCS_status_unsupported;
+ }
+
+ // target
+ if (InsertJsonStringObj (CsJson, "target", CSPtr->target) != RedfishCS_status_success) {goto Error;}
+
+ // title
+ if (InsertJsonStringObj (CsJson, "title", CSPtr->title) != RedfishCS_status_success) {goto Error;}
+
+ // Set to parent JSON object.
+ if (json_object_set_new (CsParentJson, Key, CsJson) == -1) {goto Error;}
+
+ return RedfishCS_status_success;
+Error:;
+ return RedfishCS_status_unsupported;
+}
+static RedfishCS_status CS_To_JSON_ActionsBios_ResetBios(json_t *CsJson, char *Key, RedfishBios_V1_0_9_ResetBios_CS *CSPtr)
+{
+ json_t *CsParentJson;
+
+ if (CSPtr == NULL) {
+ return RedfishCS_status_success;
+ }
+
+ CsParentJson = CsJson;
+ CsJson = json_object();
+ if (CsJson == NULL) {
+ return RedfishCS_status_unsupported;
+ }
+
+ // target
+ if (InsertJsonStringObj (CsJson, "target", CSPtr->target) != RedfishCS_status_success) {goto Error;}
+
+ // title
+ if (InsertJsonStringObj (CsJson, "title", CSPtr->title) != RedfishCS_status_success) {goto Error;}
+
+ // Set to parent JSON object.
+ if (json_object_set_new (CsParentJson, Key, CsJson) == -1) {goto Error;}
+
+ return RedfishCS_status_success;
+Error:;
+ return RedfishCS_status_unsupported;
+}
+static RedfishCS_status CS_To_JSON_ActionsOem(json_t *CsJson, char *Key, RedfishBios_V1_0_9_OemActions_CS *CSPtr)
+{
+ json_t *CsParentJson;
+
+ if (CSPtr == NULL) {
+ return RedfishCS_status_success;
+ }
+
+ CsParentJson = CsJson;
+ CsJson = json_object();
+ if (CsJson == NULL) {
+ return RedfishCS_status_unsupported;
+ }
+
+ // Check if this is RedfishCS_Type_CS_EmptyProp.
+ CsEmptyPropLinkToJson(CsJson, Key, &CSPtr->Prop);
+ // No JSON property for this structure.
+ return RedfishCS_status_success;
+}
+static RedfishCS_status CS_To_JSON_Actions(json_t *CsJson, char *Key, RedfishBios_V1_0_9_Actions_CS *CSPtr)
+{
+ json_t *CsParentJson;
+
+ if (CSPtr == NULL) {
+ return RedfishCS_status_success;
+ }
+
+ CsParentJson = CsJson;
+ CsJson = json_object();
+ if (CsJson == NULL) {
+ return RedfishCS_status_unsupported;
+ }
+
+ // #Bios.ChangePassword
+ if (CS_To_JSON_ActionsBios_ChangePassword(CsJson, "#Bios.ChangePassword", CSPtr->Bios_ChangePassword) != RedfishCS_status_success) {goto Error;}
+
+ // #Bios.ResetBios
+ if (CS_To_JSON_ActionsBios_ResetBios(CsJson, "#Bios.ResetBios", CSPtr->Bios_ResetBios) != RedfishCS_status_success) {goto Error;}
+
+ // Oem
+ if (CS_To_JSON_ActionsOem(CsJson, "Oem", CSPtr->Oem) != RedfishCS_status_success) {goto Error;}
+
+ // Set to parent JSON object.
+ if (json_object_set_new (CsParentJson, Key, CsJson) == -1) {goto Error;}
+
+ return RedfishCS_status_success;
+Error:;
+ return RedfishCS_status_unsupported;
+}
+static RedfishCS_status CS_To_JSON_Attributes(json_t *CsJson, char *Key, RedfishBios_V1_0_9_Attributes_CS *CSPtr)
+{
+ //json_t *CsParentJson;
+
+ if (CSPtr == NULL) {
+ return RedfishCS_status_success;
+ }
+
+ //CsParentJson = CsJson;
+ //CsJson = json_object();
+ //if (CsJson == NULL) {
+ // return RedfishCS_status_unsupported;
+ //}
+
+ // Check if this is RedfishCS_Type_CS_EmptyProp.
+ CsEmptyPropLinkToJson(CsJson, Key, &CSPtr->Prop);
+ // No JSON property for this structure.
+ return RedfishCS_status_success;
+}
+static RedfishCS_status CS_To_JSON_Oem(json_t *CsJson, char *Key, RedfishResource_Oem_CS *CSPtr)
+{
+ json_t *CsParentJson;
+
+ if (CSPtr == NULL) {
+ return RedfishCS_status_success;
+ }
+
+ CsParentJson = CsJson;
+ CsJson = json_object();
+ if (CsJson == NULL) {
+ return RedfishCS_status_unsupported;
+ }
+
+ // Check if this is RedfishCS_Type_CS_EmptyProp.
+ CsEmptyPropLinkToJson(CsJson, Key, &CSPtr->Prop);
+ // No JSON property for this structure.
+ return RedfishCS_status_success;
+}
+
+//
+// C structure to JSON for Bios.V1_0_9.Bios
+//
+RedfishCS_status CS_To_Bios_V1_0_9_JSON(RedfishBios_V1_0_9_Bios_CS *CSPtr, RedfishCS_char **JsonText)
+{
+ json_t *CsJson;
+
+ if (CSPtr == NULL || JsonText == NULL || CSPtr->Header.ResourceType != RedfishCS_Type_CS) {
+ return RedfishCS_status_invalid_parameter;
+ }
+ CsJson = json_object();
+ if (CsJson == NULL) {
+ return RedfishCS_status_unsupported;
+ }
+ // Actions
+ if (CS_To_JSON_Actions(CsJson, "Actions", CSPtr->Actions) != RedfishCS_status_success) {goto Error;}
+
+ // AttributeRegistry
+ if (InsertJsonStringObj (CsJson, "AttributeRegistry", CSPtr->AttributeRegistry) != RedfishCS_status_success) {goto Error;}
+
+ // Attributes
+ if (CS_To_JSON_Attributes(CsJson, "Attributes", CSPtr->Attributes) != RedfishCS_status_success) {goto Error;}
+
+ // Description
+ if (InsertJsonStringObj (CsJson, "Description", CSPtr->Description) != RedfishCS_status_success) {goto Error;}
+
+ // Id
+ if (InsertJsonStringObj (CsJson, "Id", CSPtr->Id) != RedfishCS_status_success) {goto Error;}
+
+ // Name
+ if (InsertJsonStringObj (CsJson, "Name", CSPtr->Name) != RedfishCS_status_success) {goto Error;}
+
+ // Oem
+ if (CS_To_JSON_Oem(CsJson, "Oem", CSPtr->Oem) != RedfishCS_status_success) {goto Error;}
+
+ // @odata.context
+ if (InsertJsonStringObj (CsJson, "@odata.context", CSPtr->odata_context) != RedfishCS_status_success) {goto Error;}
+
+ // @odata.etag
+ if (InsertJsonStringObj (CsJson, "@odata.etag", CSPtr->odata_etag) != RedfishCS_status_success) {goto Error;}
+
+ // @odata.id
+ if (InsertJsonStringObj (CsJson, "@odata.id", CSPtr->odata_id) != RedfishCS_status_success) {goto Error;}
+
+ // @odata.type
+ if (InsertJsonStringObj (CsJson, "@odata.type", CSPtr->odata_type) != RedfishCS_status_success) {goto Error;}
+
+ *JsonText = (RedfishCS_char *)json_dumps(CsJson, JSON_INDENT(2 * 1) | JSON_ENSURE_ASCII);
+ json_decref(CsJson);
+ return RedfishCS_status_success;
+Error:;
+ json_decref(CsJson);
+ return RedfishCS_status_unsupported;
+}
+
+//
+// Destory C Structure for Bios.V1_0_9.Bios
+//
+RedfishCS_status DestroyBios_V1_0_9_CS(RedfishBios_V1_0_9_Bios_CS *CSPtr)
+{
+ RedfishCS_status Status;
+
+ Status = DestoryCsMemory ((RedfishCS_void *)CSPtr);
+ return Status;
+}
+
+//
+// Destory JSON text for Bios.V1_0_9.Bios
+//
+RedfishCS_status DestroyBios_V1_0_9_Json(RedfishCS_char *JsonText)
+{
+ free ((RedfishCS_void *)JsonText);
+ return RedfishCS_status_success;
+}
+
+//
+//Generate C structure for Bios.V1_0_9.Bios
+//
+RedfishCS_status
+Json_Bios_V1_0_9_To_CS(RedfishCS_char *JsonRawText, RedfishBios_V1_0_9_Bios_CS **ReturnedCs)
+{
+ RedfishCS_status Status;
+ json_t *JsonObj;
+ RedfishBios_V1_0_9_Bios_CS *Cs;
+
+ Status = CreateJsonPayloadAndCs (JsonRawText, "Bios", "v1_0_9", "Bios", &JsonObj, (RedfishCS_void **)&Cs, sizeof (RedfishBios_V1_0_9_Bios_CS));
+ if (Status != RedfishCS_status_success) {
+ goto Error;
+ }
+
+ // @odata.context
+ Status = GetRedfishPropertyStr (Cs, JsonObj, "@odata.context", &Cs->odata_context);
+ if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
+ else {if (Status == RedfishCS_status_not_found){/*This is not the required property.*/}}
+
+ // @odata.etag
+ Status = GetRedfishPropertyStr (Cs, JsonObj, "@odata.etag", &Cs->odata_etag);
+ if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
+ else {if (Status == RedfishCS_status_not_found){/*This is not the required property.*/}}
+
+ // @odata.id
+ Status = GetRedfishPropertyStr (Cs, JsonObj, "@odata.id", &Cs->odata_id);
+ if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
+ else {if (Status == RedfishCS_status_not_found){goto Error;}}
+
+ // @odata.type
+ Status = GetRedfishPropertyStr (Cs, JsonObj, "@odata.type", &Cs->odata_type);
+ if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
+ else {if (Status == RedfishCS_status_not_found){goto Error;}}
+
+ // Actions
+ Status = GenActionsCs (Cs, JsonObj, "Actions", &Cs->Actions);
+ if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
+ else {if (Status == RedfishCS_status_not_found){/*This is not the required property.*/}}
+
+ // AttributeRegistry
+ Status = GetRedfishPropertyStr (Cs, JsonObj, "AttributeRegistry", &Cs->AttributeRegistry);
+ if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
+ else {if (Status == RedfishCS_status_not_found){/*This is not the required property.*/}}
+
+ // Attributes
+ Status = GenAttributesCs (Cs, JsonObj, "Attributes", &Cs->Attributes);
+ if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
+ else {if (Status == RedfishCS_status_not_found){/*This is not the required property.*/}}
+
+ // Description
+ Status = GetRedfishPropertyStr (Cs, JsonObj, "Description", &Cs->Description);
+ if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
+ else {if (Status == RedfishCS_status_not_found){/*This is not the required property.*/}}
+
+ // Id
+ Status = GetRedfishPropertyStr (Cs, JsonObj, "Id", &Cs->Id);
+ if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
+ else {if (Status == RedfishCS_status_not_found){goto Error;}}
+
+ // Name
+ Status = GetRedfishPropertyStr (Cs, JsonObj, "Name", &Cs->Name);
+ if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
+ else {if (Status == RedfishCS_status_not_found){goto Error;}}
+
+ // Oem
+ Status = GenOemCs (Cs, JsonObj, "Oem", &Cs->Oem);
+ if (Status != RedfishCS_status_success && Status != RedfishCS_status_not_found) {goto Error;}
+ else {if (Status == RedfishCS_status_not_found){/*This is not the required property.*/}}
+
+ json_decref(JsonObj);
+ *ReturnedCs = Cs;
+ return RedfishCS_status_success;
+Error:;
+ json_decref(JsonObj);
+ DestroyBios_V1_0_9_CS (Cs);
+ return Status;
+}
--
2.37.1.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [edk2-redfish-client][PATCH] RedfishClientPkg: Update Redfish converter lib
2023-05-11 0:57 [edk2-redfish-client][PATCH] RedfishClientPkg: Update Redfish converter lib Chang, Abner
@ 2023-05-11 1:04 ` Nickle Wang
0 siblings, 0 replies; 2+ messages in thread
From: Nickle Wang @ 2023-05-11 1:04 UTC (permalink / raw)
To: abner.chang@amd.com, devel@edk2.groups.io; +Cc: Igor Kulchytskyy
Reviewed-by: Nickle Wang <nicklew@nvidia.com>
Regards,
Nickle
> -----Original Message-----
> From: abner.chang@amd.com <abner.chang@amd.com>
> Sent: Thursday, May 11, 2023 8:58 AM
> To: devel@edk2.groups.io
> Cc: Nickle Wang <nicklew@nvidia.com>; Igor Kulchytskyy <igork@ami.com>
> Subject: [edk2-redfish-client][PATCH] RedfishClientPkg: Update Redfish converter
> lib
>
> External email: Use caution opening links or attachments
>
>
> From: Abner Chang <abner.chang@amd.com>
>
> Temporary modified on the auto-generated lib to support
> Redfish BIOS attributes. RedfishScemaToCStructure python
> script needs to be updated for fixing this issue.
>
> Signed-off-by: Abner Chang <abner.chang@amd.com>
> Cc: Nickle Wang <nicklew@nvidia.com>
> Cc: Igor Kulchytskyy <igork@ami.com>
> ---
> .../src/Bios/Bios.V1_0_9/Bios.V1_0_9.c | 1118 ++++++++---------
> 1 file changed, 559 insertions(+), 559 deletions(-)
>
> diff --git a/RedfishClientPkg/ConverterLib/src/Bios/Bios.V1_0_9/Bios.V1_0_9.c
> b/RedfishClientPkg/ConverterLib/src/Bios/Bios.V1_0_9/Bios.V1_0_9.c
> index d698321886..c1418c634d 100644
> --- a/RedfishClientPkg/ConverterLib/src/Bios/Bios.V1_0_9/Bios.V1_0_9.c
> +++ b/RedfishClientPkg/ConverterLib/src/Bios/Bios.V1_0_9/Bios.V1_0_9.c
> @@ -1,559 +1,559 @@
> -//
> -// Auto-generated file by Redfish Schema C Structure Generator.
> -//
> https://github.co/
> m%2FDMTF%2FRedfish-Schema-C-Struct-
> Generator&data=05%7C01%7Cnicklew%40nvidia.com%7C215698e96e474237d1
> 7608db51bac39d%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C6381
> 93634821405844%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJ
> QIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=
> nNokUJpI5nXRQtPhLUV0epV7sjQsVglZldHlMT2mOQ8%3D&reserved=0.
> -//
> -// (C) Copyright 2019-2022 Hewlett Packard Enterprise Development LP<BR>
> -//
> -// Copyright Notice:
> -// Copyright 2019-2022 Distributed Management Task Force, Inc. All rights
> reserved.
> -// License: BSD 3-Clause License. For full text see link:
> https://github.co/
> m%2FDMTF%2FRedfish-JSON-C-Struct-
> Converter%2Fblob%2Fmaster%2FLICENSE.md&data=05%7C01%7Cnicklew%40n
> vidia.com%7C215698e96e474237d17608db51bac39d%7C43083d15727340c1b7
> db39efd9ccc17a%7C0%7C0%7C638193634821405844%7CUnknown%7CTWFpb
> GZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn
> 0%3D%7C3000%7C%7C%7C&sdata=BfX7e%2BhMQ2hNW%2BTOVxjL124i%2Fnh
> obX1s384yR5NW08Q%3D&reserved=0
> -//
> -
> -#include"Redfish_Bios_v1_0_9_CS.h"
> -#include <stdlib.h>
> -#include <string.h>
> -#include <jansson.h>
> -
> -RedfishCS_bool SupportedRedfishResource (RedfishCS_char *Odata_Type,
> RedfishCS_char *NameSpace, RedfishCS_char *Version, RedfishCS_char
> *DataType);
> -RedfishCS_status CreateCsUriByNode (RedfishCS_void *Cs, json_t *JsonOj,
> RedfishCS_char *NodeName, RedfishCS_char *ParentUri,
> RedfishCS_Type_Uri_Data **CsTypeUriData);
> -RedfishCS_status CreateCsJsonByNode (RedfishCS_void *Cs, json_t *JsonOj,
> RedfishCS_char *NodeName, RedfishCS_char *ParentUri,
> RedfishCS_Type_JSON_Data **CsTypeJsonData);
> -RedfishCS_status CreateCsUriOrJsonByNode (RedfishCS_void *Cs, json_t
> *JsonObj, RedfishCS_char *NodeName, RedfishCS_char *ParentUri,
> RedfishCS_Link *LinkHead);
> -RedfishCS_status CreateCsUriOrJsonByNodeArray (RedfishCS_void *Cs, json_t
> *JsonObj, RedfishCS_char *NodeName, RedfishCS_char *ParentUri,
> RedfishCS_Link *LinkHead);
> -RedfishCS_status CreateJsonPayloadAndCs (char *JsonRawText, char
> *ResourceType, char *ResourceVersion, char *TypeName, json_t
> **JsonObjReturned, void **Cs, int size);
> -RedfishCS_status GetRedfishPropertyStr (RedfishCS_void *Cs, json_t *JsonObj,
> char *Key, RedfishCS_char **DstBuffer);
> -RedfishCS_status GetRedfishPropertyBoolean (RedfishCS_void *Cs, json_t
> *JsonObj, char *Key, RedfishCS_bool **DstBuffer);
> -RedfishCS_status GetRedfishPropertyVague (RedfishCS_void *Cs, json_t
> *JsonObj, char *Key, RedfishCS_Vague **DstBuffer);
> -RedfishCS_status DestoryCsMemory (RedfishCS_void *rootCs);
> -RedfishCS_status GetRedfishPropertyInt64 (RedfishCS_void *Cs, json_t *JsonObj,
> char *Key, RedfishCS_int64 **Dst);
> -RedfishCS_status InsertJsonStringObj (json_t *JsonObj, char *Key, char
> *StringValue);
> -RedfishCS_status InsertJsonLinkObj (json_t *JsonObj, char *Key, RedfishCS_Link
> *Link);
> -RedfishCS_status InsertJsonInt64Obj (json_t *ParentJsonObj, char *Key,
> RedfishCS_int64 *Int64Value);
> -RedfishCS_status InsertJsonBoolObj (json_t *ParentJsonObj, char *Key,
> RedfishCS_bool *BoolValue);
> -RedfishCS_status InsertJsonStringArrayObj (json_t *JsonObj, char *Key,
> RedfishCS_char_Array *StringValueArray);
> -RedfishCS_status InsertJsonLinkArrayObj (json_t *JsonObj, char *Key,
> RedfishCS_Link *LinkArray);
> -RedfishCS_status InsertJsonInt64ArrayObj (json_t *ParentJsonObj, char *Key,
> RedfishCS_int64_Array *Int64ValueArray);
> -RedfishCS_status InsertJsonBoolArrayObj (json_t *ParentJsonObj, char *Key,
> RedfishCS_bool_Array *BoolValueArray);
> -RedfishCS_status InsertJsonVagueObj (json_t *ParentJsonObj, char *Key,
> RedfishCS_Vague *VagueValue);
> -RedfishCS_bool CheckEmptyPropJsonObject(json_t *JsonObj, RedfishCS_uint32
> *NumOfProperty);
> -RedfishCS_status CreateEmptyPropCsJson(RedfishCS_void *Cs, json_t *JsonOj,
> RedfishCS_char *NodeName, RedfishCS_char *ParentUri,
> RedfishCS_Type_EmptyProp_CS_Data **CsTypeEmptyPropCS, RedfishCS_uint32
> NunmOfProperties);
> -RedfishCS_status CsEmptyPropLinkToJson(json_t *CsJson, char *Key,
> RedfishCS_Link *Link);
> -
> -//
> -//Generate C structure for #Bios.ChangePassword
> -//
> -static RedfishCS_status GenChangePasswordCs(RedfishBios_V1_0_9_Bios_CS
> *Cs, json_t *JsonObj, char *Key, RedfishBios_V1_0_9_ChangePassword_CS
> **Dst)
> -{
> - RedfishCS_status Status;
> - json_t *TempJsonObj;
> -
> - Status = RedfishCS_status_success;
> - TempJsonObj = json_object_get(JsonObj, Key);
> - if (TempJsonObj == NULL) {
> - return RedfishCS_status_not_found;
> - }
> - Status = allocateRecordCsMemory(Cs,
> sizeof(RedfishBios_V1_0_9_ChangePassword_CS), (RedfishCS_void **)Dst);
> - if (Status != RedfishCS_status_success){
> - goto Error;
> - }
> - // target
> - Status = GetRedfishPropertyStr (Cs, TempJsonObj, "target", &(*Dst)->target);
> - if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> - else {if (Status == RedfishCS_status_not_found){/*This is not the required
> property.*/}}
> -
> - // title
> - Status = GetRedfishPropertyStr (Cs, TempJsonObj, "title", &(*Dst)->title);
> - if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> - else {if (Status == RedfishCS_status_not_found){/*This is not the required
> property.*/}}
> -
> -Error:;
> - return Status;
> -}
> -//
> -//Generate C structure for #Bios.ResetBios
> -//
> -static RedfishCS_status GenResetBiosCs(RedfishBios_V1_0_9_Bios_CS *Cs,
> json_t *JsonObj, char *Key, RedfishBios_V1_0_9_ResetBios_CS **Dst)
> -{
> - RedfishCS_status Status;
> - json_t *TempJsonObj;
> -
> - Status = RedfishCS_status_success;
> - TempJsonObj = json_object_get(JsonObj, Key);
> - if (TempJsonObj == NULL) {
> - return RedfishCS_status_not_found;
> - }
> - Status = allocateRecordCsMemory(Cs,
> sizeof(RedfishBios_V1_0_9_ResetBios_CS), (RedfishCS_void **)Dst);
> - if (Status != RedfishCS_status_success){
> - goto Error;
> - }
> - // target
> - Status = GetRedfishPropertyStr (Cs, TempJsonObj, "target", &(*Dst)->target);
> - if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> - else {if (Status == RedfishCS_status_not_found){/*This is not the required
> property.*/}}
> -
> - // title
> - Status = GetRedfishPropertyStr (Cs, TempJsonObj, "title", &(*Dst)->title);
> - if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> - else {if (Status == RedfishCS_status_not_found){/*This is not the required
> property.*/}}
> -
> -Error:;
> - return Status;
> -}
> -//
> -//Generate C structure for Oem
> -//
> -static RedfishCS_status GenOemActionsCs(RedfishBios_V1_0_9_Bios_CS *Cs,
> json_t *JsonObj, char *Key, RedfishBios_V1_0_9_OemActions_CS **Dst)
> -{
> - RedfishCS_status Status;
> - RedfishCS_Type_JSON_Data *CsTypeJson;
> - RedfishCS_Type_EmptyProp_CS_Data *CsTypeEmptyPropCS;
> - RedfishCS_uint32 NunmOfEmptyPropProperties;
> - json_t *TempJsonObj;
> -
> - Status = RedfishCS_status_success;
> - TempJsonObj = json_object_get(JsonObj, Key);
> - if (TempJsonObj == NULL) {
> - return RedfishCS_status_not_found;
> - }
> - Status = allocateRecordCsMemory(Cs,
> sizeof(RedfishBios_V1_0_9_OemActions_CS), (RedfishCS_void **)Dst);
> - if (Status != RedfishCS_status_success){
> - goto Error;
> - }
> - InitializeLinkHead (&(*Dst)->Prop);
> -
> - //
> - // Try to create C structure if the property is
> - // declared as empty property in schema. The supported property type
> - // is string, integer, real, number and boolean.
> - //
> - if (CheckEmptyPropJsonObject(TempJsonObj, &NunmOfEmptyPropProperties)) {
> - Status = CreateEmptyPropCsJson(Cs, JsonObj, Key, Cs->Header.ThisUri,
> &CsTypeEmptyPropCS, NunmOfEmptyPropProperties);
> - if (Status != RedfishCS_status_success) {
> - goto Error;
> - }
> - InsertTailLink(&(*Dst)->Prop, &CsTypeEmptyPropCS->Header.LinkEntry);
> - } else {
> - Status = CreateCsJsonByNode (Cs, JsonObj, Key, Cs->Header.ThisUri,
> &CsTypeJson);
> - if (Status != RedfishCS_status_success) {
> - goto Error;
> - }
> - InsertTailLink(&(*Dst)->Prop, &CsTypeJson->Header.LinkEntry);
> - }
> -Error:;
> - return Status;
> -}
> -//
> -//Generate C structure for Actions
> -//
> -static RedfishCS_status GenActionsCs(RedfishBios_V1_0_9_Bios_CS *Cs, json_t
> *JsonObj, char *Key, RedfishBios_V1_0_9_Actions_CS **Dst)
> -{
> - RedfishCS_status Status;
> - json_t *TempJsonObj;
> -
> - Status = RedfishCS_status_success;
> - TempJsonObj = json_object_get(JsonObj, Key);
> - if (TempJsonObj == NULL) {
> - return RedfishCS_status_not_found;
> - }
> - Status = allocateRecordCsMemory(Cs, sizeof(RedfishBios_V1_0_9_Actions_CS),
> (RedfishCS_void **)Dst);
> - if (Status != RedfishCS_status_success){
> - goto Error;
> - }
> - // #Bios.ChangePassword
> - Status = GenChangePasswordCs (Cs, TempJsonObj, "#Bios.ChangePassword",
> &(*Dst)->Bios_ChangePassword);
> - if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> - else {if (Status == RedfishCS_status_not_found){/*This is not the required
> property.*/}}
> -
> - // #Bios.ResetBios
> - Status = GenResetBiosCs (Cs, TempJsonObj, "#Bios.ResetBios", &(*Dst)-
> >Bios_ResetBios);
> - if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> - else {if (Status == RedfishCS_status_not_found){/*This is not the required
> property.*/}}
> -
> - // Oem
> - Status = GenOemActionsCs (Cs, TempJsonObj, "Oem", &(*Dst)->Oem);
> - if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> - else {if (Status == RedfishCS_status_not_found){/*This is not the required
> property.*/}}
> -
> -Error:;
> - return Status;
> -}
> -//
> -//Generate C structure for Attributes
> -//
> -static RedfishCS_status GenAttributesCs(RedfishBios_V1_0_9_Bios_CS *Cs,
> json_t *JsonObj, char *Key, RedfishBios_V1_0_9_Attributes_CS **Dst)
> -{
> - RedfishCS_status Status;
> - RedfishCS_Type_JSON_Data *CsTypeJson;
> - RedfishCS_Type_EmptyProp_CS_Data *CsTypeEmptyPropCS;
> - RedfishCS_uint32 NunmOfEmptyPropProperties;
> - json_t *TempJsonObj;
> -
> - Status = RedfishCS_status_success;
> - TempJsonObj = json_object_get(JsonObj, Key);
> - if (TempJsonObj == NULL) {
> - return RedfishCS_status_not_found;
> - }
> - Status = allocateRecordCsMemory(Cs,
> sizeof(RedfishBios_V1_0_9_Attributes_CS), (RedfishCS_void **)Dst);
> - if (Status != RedfishCS_status_success){
> - goto Error;
> - }
> - InitializeLinkHead (&(*Dst)->Prop);
> -
> - //
> - // Try to create C structure if the property is
> - // declared as empty property in schema. The supported property type
> - // is string, integer, real, number and boolean.
> - //
> - if (CheckEmptyPropJsonObject(TempJsonObj, &NunmOfEmptyPropProperties)) {
> - Status = CreateEmptyPropCsJson(Cs, JsonObj, Key, Cs->Header.ThisUri,
> &CsTypeEmptyPropCS, NunmOfEmptyPropProperties);
> - if (Status != RedfishCS_status_success) {
> - goto Error;
> - }
> - InsertTailLink(&(*Dst)->Prop, &CsTypeEmptyPropCS->Header.LinkEntry);
> - } else {
> - Status = CreateCsJsonByNode (Cs, JsonObj, Key, Cs->Header.ThisUri,
> &CsTypeJson);
> - if (Status != RedfishCS_status_success) {
> - goto Error;
> - }
> - InsertTailLink(&(*Dst)->Prop, &CsTypeJson->Header.LinkEntry);
> - }
> -Error:;
> - return Status;
> -}
> -//
> -//Generate C structure for Oem
> -//
> -static RedfishCS_status GenOemCs(RedfishBios_V1_0_9_Bios_CS *Cs, json_t
> *JsonObj, char *Key, RedfishResource_Oem_CS **Dst)
> -{
> - RedfishCS_status Status;
> - RedfishCS_Type_JSON_Data *CsTypeJson;
> - RedfishCS_Type_EmptyProp_CS_Data *CsTypeEmptyPropCS;
> - RedfishCS_uint32 NunmOfEmptyPropProperties;
> - json_t *TempJsonObj;
> -
> - Status = RedfishCS_status_success;
> - TempJsonObj = json_object_get(JsonObj, Key);
> - if (TempJsonObj == NULL) {
> - return RedfishCS_status_not_found;
> - }
> - Status = allocateRecordCsMemory(Cs, sizeof(RedfishResource_Oem_CS),
> (RedfishCS_void **)Dst);
> - if (Status != RedfishCS_status_success){
> - goto Error;
> - }
> - InitializeLinkHead (&(*Dst)->Prop);
> -
> - //
> - // Try to create C structure if the property is
> - // declared as empty property in schema. The supported property type
> - // is string, integer, real, number and boolean.
> - //
> - if (CheckEmptyPropJsonObject(TempJsonObj, &NunmOfEmptyPropProperties)) {
> - Status = CreateEmptyPropCsJson(Cs, JsonObj, Key, Cs->Header.ThisUri,
> &CsTypeEmptyPropCS, NunmOfEmptyPropProperties);
> - if (Status != RedfishCS_status_success) {
> - goto Error;
> - }
> - InsertTailLink(&(*Dst)->Prop, &CsTypeEmptyPropCS->Header.LinkEntry);
> - } else {
> - Status = CreateCsJsonByNode (Cs, JsonObj, Key, Cs->Header.ThisUri,
> &CsTypeJson);
> - if (Status != RedfishCS_status_success) {
> - goto Error;
> - }
> - InsertTailLink(&(*Dst)->Prop, &CsTypeJson->Header.LinkEntry);
> - }
> -Error:;
> - return Status;
> -}
> -static RedfishCS_status CS_To_JSON_ActionsBios_ChangePassword(json_t
> *CsJson, char *Key, RedfishBios_V1_0_9_ChangePassword_CS *CSPtr)
> -{
> - json_t *CsParentJson;
> -
> - if (CSPtr == NULL) {
> - return RedfishCS_status_success;
> - }
> -
> - CsParentJson = CsJson;
> - CsJson = json_object();
> - if (CsJson == NULL) {
> - return RedfishCS_status_unsupported;
> - }
> -
> - // target
> - if (InsertJsonStringObj (CsJson, "target", CSPtr->target) !=
> RedfishCS_status_success) {goto Error;}
> -
> - // title
> - if (InsertJsonStringObj (CsJson, "title", CSPtr->title) !=
> RedfishCS_status_success) {goto Error;}
> -
> - // Set to parent JSON object.
> - if (json_object_set_new (CsParentJson, Key, CsJson) == -1) {goto Error;}
> -
> - return RedfishCS_status_success;
> -Error:;
> - return RedfishCS_status_unsupported;
> -}
> -static RedfishCS_status CS_To_JSON_ActionsBios_ResetBios(json_t *CsJson, char
> *Key, RedfishBios_V1_0_9_ResetBios_CS *CSPtr)
> -{
> - json_t *CsParentJson;
> -
> - if (CSPtr == NULL) {
> - return RedfishCS_status_success;
> - }
> -
> - CsParentJson = CsJson;
> - CsJson = json_object();
> - if (CsJson == NULL) {
> - return RedfishCS_status_unsupported;
> - }
> -
> - // target
> - if (InsertJsonStringObj (CsJson, "target", CSPtr->target) !=
> RedfishCS_status_success) {goto Error;}
> -
> - // title
> - if (InsertJsonStringObj (CsJson, "title", CSPtr->title) !=
> RedfishCS_status_success) {goto Error;}
> -
> - // Set to parent JSON object.
> - if (json_object_set_new (CsParentJson, Key, CsJson) == -1) {goto Error;}
> -
> - return RedfishCS_status_success;
> -Error:;
> - return RedfishCS_status_unsupported;
> -}
> -static RedfishCS_status CS_To_JSON_ActionsOem(json_t *CsJson, char *Key,
> RedfishBios_V1_0_9_OemActions_CS *CSPtr)
> -{
> - json_t *CsParentJson;
> -
> - if (CSPtr == NULL) {
> - return RedfishCS_status_success;
> - }
> -
> - CsParentJson = CsJson;
> - CsJson = json_object();
> - if (CsJson == NULL) {
> - return RedfishCS_status_unsupported;
> - }
> -
> - // Check if this is RedfishCS_Type_CS_EmptyProp.
> - CsEmptyPropLinkToJson(CsJson, Key, &CSPtr->Prop);
> - // No JSON property for this structure.
> - return RedfishCS_status_success;
> -}
> -static RedfishCS_status CS_To_JSON_Actions(json_t *CsJson, char *Key,
> RedfishBios_V1_0_9_Actions_CS *CSPtr)
> -{
> - json_t *CsParentJson;
> -
> - if (CSPtr == NULL) {
> - return RedfishCS_status_success;
> - }
> -
> - CsParentJson = CsJson;
> - CsJson = json_object();
> - if (CsJson == NULL) {
> - return RedfishCS_status_unsupported;
> - }
> -
> - // #Bios.ChangePassword
> - if (CS_To_JSON_ActionsBios_ChangePassword(CsJson,
> "#Bios.ChangePassword", CSPtr->Bios_ChangePassword) !=
> RedfishCS_status_success) {goto Error;}
> -
> - // #Bios.ResetBios
> - if (CS_To_JSON_ActionsBios_ResetBios(CsJson, "#Bios.ResetBios", CSPtr-
> >Bios_ResetBios) != RedfishCS_status_success) {goto Error;}
> -
> - // Oem
> - if (CS_To_JSON_ActionsOem(CsJson, "Oem", CSPtr->Oem) !=
> RedfishCS_status_success) {goto Error;}
> -
> - // Set to parent JSON object.
> - if (json_object_set_new (CsParentJson, Key, CsJson) == -1) {goto Error;}
> -
> - return RedfishCS_status_success;
> -Error:;
> - return RedfishCS_status_unsupported;
> -}
> -static RedfishCS_status CS_To_JSON_Attributes(json_t *CsJson, char *Key,
> RedfishBios_V1_0_9_Attributes_CS *CSPtr)
> -{
> - json_t *CsParentJson;
> -
> - if (CSPtr == NULL) {
> - return RedfishCS_status_success;
> - }
> -
> - CsParentJson = CsJson;
> - CsJson = json_object();
> - if (CsJson == NULL) {
> - return RedfishCS_status_unsupported;
> - }
> -
> - // Check if this is RedfishCS_Type_CS_EmptyProp.
> - CsEmptyPropLinkToJson(CsJson, Key, &CSPtr->Prop);
> - // No JSON property for this structure.
> - return RedfishCS_status_success;
> -}
> -static RedfishCS_status CS_To_JSON_Oem(json_t *CsJson, char *Key,
> RedfishResource_Oem_CS *CSPtr)
> -{
> - json_t *CsParentJson;
> -
> - if (CSPtr == NULL) {
> - return RedfishCS_status_success;
> - }
> -
> - CsParentJson = CsJson;
> - CsJson = json_object();
> - if (CsJson == NULL) {
> - return RedfishCS_status_unsupported;
> - }
> -
> - // Check if this is RedfishCS_Type_CS_EmptyProp.
> - CsEmptyPropLinkToJson(CsJson, Key, &CSPtr->Prop);
> - // No JSON property for this structure.
> - return RedfishCS_status_success;
> -}
> -
> -//
> -// C structure to JSON for Bios.V1_0_9.Bios
> -//
> -RedfishCS_status CS_To_Bios_V1_0_9_JSON(RedfishBios_V1_0_9_Bios_CS
> *CSPtr, RedfishCS_char **JsonText)
> -{
> - json_t *CsJson;
> -
> - if (CSPtr == NULL || JsonText == NULL || CSPtr->Header.ResourceType !=
> RedfishCS_Type_CS) {
> - return RedfishCS_status_invalid_parameter;
> - }
> - CsJson = json_object();
> - if (CsJson == NULL) {
> - return RedfishCS_status_unsupported;
> - }
> - // Actions
> - if (CS_To_JSON_Actions(CsJson, "Actions", CSPtr->Actions) !=
> RedfishCS_status_success) {goto Error;}
> -
> - // AttributeRegistry
> - if (InsertJsonStringObj (CsJson, "AttributeRegistry", CSPtr->AttributeRegistry) !=
> RedfishCS_status_success) {goto Error;}
> -
> - // Attributes
> - if (CS_To_JSON_Attributes(CsJson, "Attributes", CSPtr->Attributes) !=
> RedfishCS_status_success) {goto Error;}
> -
> - // Description
> - if (InsertJsonStringObj (CsJson, "Description", CSPtr->Description) !=
> RedfishCS_status_success) {goto Error;}
> -
> - // Id
> - if (InsertJsonStringObj (CsJson, "Id", CSPtr->Id) != RedfishCS_status_success)
> {goto Error;}
> -
> - // Name
> - if (InsertJsonStringObj (CsJson, "Name", CSPtr->Name) !=
> RedfishCS_status_success) {goto Error;}
> -
> - // Oem
> - if (CS_To_JSON_Oem(CsJson, "Oem", CSPtr->Oem) !=
> RedfishCS_status_success) {goto Error;}
> -
> - // @odata.context
> - if (InsertJsonStringObj (CsJson, "@odata.context", CSPtr->odata_context) !=
> RedfishCS_status_success) {goto Error;}
> -
> - // @odata.etag
> - if (InsertJsonStringObj (CsJson, "@odata.etag", CSPtr->odata_etag) !=
> RedfishCS_status_success) {goto Error;}
> -
> - // @odata.id
> - if (InsertJsonStringObj (CsJson, "@odata.id", CSPtr->odata_id) !=
> RedfishCS_status_success) {goto Error;}
> -
> - // @odata.type
> - if (InsertJsonStringObj (CsJson, "@odata.type", CSPtr->odata_type) !=
> RedfishCS_status_success) {goto Error;}
> -
> - *JsonText = (RedfishCS_char *)json_dumps(CsJson, JSON_INDENT(2 * 1) |
> JSON_ENSURE_ASCII);
> - json_decref(CsJson);
> - return RedfishCS_status_success;
> -Error:;
> - json_decref(CsJson);
> - return RedfishCS_status_unsupported;
> -}
> -
> -//
> -// Destory C Structure for Bios.V1_0_9.Bios
> -//
> -RedfishCS_status DestroyBios_V1_0_9_CS(RedfishBios_V1_0_9_Bios_CS *CSPtr)
> -{
> - RedfishCS_status Status;
> -
> - Status = DestoryCsMemory ((RedfishCS_void *)CSPtr);
> - return Status;
> -}
> -
> -//
> -// Destory JSON text for Bios.V1_0_9.Bios
> -//
> -RedfishCS_status DestroyBios_V1_0_9_Json(RedfishCS_char *JsonText)
> -{
> - free ((RedfishCS_void *)JsonText);
> - return RedfishCS_status_success;
> -}
> -
> -//
> -//Generate C structure for Bios.V1_0_9.Bios
> -//
> -RedfishCS_status
> -Json_Bios_V1_0_9_To_CS(RedfishCS_char *JsonRawText,
> RedfishBios_V1_0_9_Bios_CS **ReturnedCs)
> -{
> - RedfishCS_status Status;
> - json_t *JsonObj;
> - RedfishBios_V1_0_9_Bios_CS *Cs;
> -
> - Status = CreateJsonPayloadAndCs (JsonRawText, "Bios", "v1_0_9", "Bios",
> &JsonObj, (RedfishCS_void **)&Cs, sizeof (RedfishBios_V1_0_9_Bios_CS));
> - if (Status != RedfishCS_status_success) {
> - goto Error;
> - }
> -
> - // @odata.context
> - Status = GetRedfishPropertyStr (Cs, JsonObj, "@odata.context", &Cs-
> >odata_context);
> - if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> - else {if (Status == RedfishCS_status_not_found){/*This is not the required
> property.*/}}
> -
> - // @odata.etag
> - Status = GetRedfishPropertyStr (Cs, JsonObj, "@odata.etag", &Cs->odata_etag);
> - if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> - else {if (Status == RedfishCS_status_not_found){/*This is not the required
> property.*/}}
> -
> - // @odata.id
> - Status = GetRedfishPropertyStr (Cs, JsonObj, "@odata.id", &Cs->odata_id);
> - if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> - else {if (Status == RedfishCS_status_not_found){goto Error;}}
> -
> - // @odata.type
> - Status = GetRedfishPropertyStr (Cs, JsonObj, "@odata.type", &Cs->odata_type);
> - if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> - else {if (Status == RedfishCS_status_not_found){goto Error;}}
> -
> - // Actions
> - Status = GenActionsCs (Cs, JsonObj, "Actions", &Cs->Actions);
> - if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> - else {if (Status == RedfishCS_status_not_found){/*This is not the required
> property.*/}}
> -
> - // AttributeRegistry
> - Status = GetRedfishPropertyStr (Cs, JsonObj, "AttributeRegistry", &Cs-
> >AttributeRegistry);
> - if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> - else {if (Status == RedfishCS_status_not_found){/*This is not the required
> property.*/}}
> -
> - // Attributes
> - Status = GenAttributesCs (Cs, JsonObj, "Attributes", &Cs->Attributes);
> - if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> - else {if (Status == RedfishCS_status_not_found){/*This is not the required
> property.*/}}
> -
> - // Description
> - Status = GetRedfishPropertyStr (Cs, JsonObj, "Description", &Cs->Description);
> - if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> - else {if (Status == RedfishCS_status_not_found){/*This is not the required
> property.*/}}
> -
> - // Id
> - Status = GetRedfishPropertyStr (Cs, JsonObj, "Id", &Cs->Id);
> - if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> - else {if (Status == RedfishCS_status_not_found){goto Error;}}
> -
> - // Name
> - Status = GetRedfishPropertyStr (Cs, JsonObj, "Name", &Cs->Name);
> - if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> - else {if (Status == RedfishCS_status_not_found){goto Error;}}
> -
> - // Oem
> - Status = GenOemCs (Cs, JsonObj, "Oem", &Cs->Oem);
> - if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> - else {if (Status == RedfishCS_status_not_found){/*This is not the required
> property.*/}}
> -
> - json_decref(JsonObj);
> - *ReturnedCs = Cs;
> - return RedfishCS_status_success;
> -Error:;
> - json_decref(JsonObj);
> - DestroyBios_V1_0_9_CS (Cs);
> - return Status;
> -}
> +//
> +// Auto-generated file by Redfish Schema C Structure Generator.
> +//
> https://github.co/
> m%2FDMTF%2FRedfish-Schema-C-Struct-
> Generator&data=05%7C01%7Cnicklew%40nvidia.com%7C215698e96e474237d1
> 7608db51bac39d%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C6381
> 93634821405844%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJ
> QIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=
> nNokUJpI5nXRQtPhLUV0epV7sjQsVglZldHlMT2mOQ8%3D&reserved=0.
> +//
> +// (C) Copyright 2019-2022 Hewlett Packard Enterprise Development LP<BR>
> +//
> +// Copyright Notice:
> +// Copyright 2019-2022 Distributed Management Task Force, Inc. All rights
> reserved.
> +// License: BSD 3-Clause License. For full text see link:
> https://github.co/
> m%2FDMTF%2FRedfish-JSON-C-Struct-
> Converter%2Fblob%2Fmaster%2FLICENSE.md&data=05%7C01%7Cnicklew%40n
> vidia.com%7C215698e96e474237d17608db51bac39d%7C43083d15727340c1b7
> db39efd9ccc17a%7C0%7C0%7C638193634821405844%7CUnknown%7CTWFpb
> GZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn
> 0%3D%7C3000%7C%7C%7C&sdata=BfX7e%2BhMQ2hNW%2BTOVxjL124i%2Fnh
> obX1s384yR5NW08Q%3D&reserved=0
> +//
> +
> +#include"Redfish_Bios_v1_0_9_CS.h"
> +#include <stdlib.h>
> +#include <string.h>
> +#include <jansson.h>
> +
> +RedfishCS_bool SupportedRedfishResource (RedfishCS_char *Odata_Type,
> RedfishCS_char *NameSpace, RedfishCS_char *Version, RedfishCS_char
> *DataType);
> +RedfishCS_status CreateCsUriByNode (RedfishCS_void *Cs, json_t *JsonOj,
> RedfishCS_char *NodeName, RedfishCS_char *ParentUri,
> RedfishCS_Type_Uri_Data **CsTypeUriData);
> +RedfishCS_status CreateCsJsonByNode (RedfishCS_void *Cs, json_t *JsonOj,
> RedfishCS_char *NodeName, RedfishCS_char *ParentUri,
> RedfishCS_Type_JSON_Data **CsTypeJsonData);
> +RedfishCS_status CreateCsUriOrJsonByNode (RedfishCS_void *Cs, json_t
> *JsonObj, RedfishCS_char *NodeName, RedfishCS_char *ParentUri,
> RedfishCS_Link *LinkHead);
> +RedfishCS_status CreateCsUriOrJsonByNodeArray (RedfishCS_void *Cs, json_t
> *JsonObj, RedfishCS_char *NodeName, RedfishCS_char *ParentUri,
> RedfishCS_Link *LinkHead);
> +RedfishCS_status CreateJsonPayloadAndCs (char *JsonRawText, char
> *ResourceType, char *ResourceVersion, char *TypeName, json_t
> **JsonObjReturned, void **Cs, int size);
> +RedfishCS_status GetRedfishPropertyStr (RedfishCS_void *Cs, json_t *JsonObj,
> char *Key, RedfishCS_char **DstBuffer);
> +RedfishCS_status GetRedfishPropertyBoolean (RedfishCS_void *Cs, json_t
> *JsonObj, char *Key, RedfishCS_bool **DstBuffer);
> +RedfishCS_status GetRedfishPropertyVague (RedfishCS_void *Cs, json_t
> *JsonObj, char *Key, RedfishCS_Vague **DstBuffer);
> +RedfishCS_status DestoryCsMemory (RedfishCS_void *rootCs);
> +RedfishCS_status GetRedfishPropertyInt64 (RedfishCS_void *Cs, json_t
> *JsonObj, char *Key, RedfishCS_int64 **Dst);
> +RedfishCS_status InsertJsonStringObj (json_t *JsonObj, char *Key, char
> *StringValue);
> +RedfishCS_status InsertJsonLinkObj (json_t *JsonObj, char *Key, RedfishCS_Link
> *Link);
> +RedfishCS_status InsertJsonInt64Obj (json_t *ParentJsonObj, char *Key,
> RedfishCS_int64 *Int64Value);
> +RedfishCS_status InsertJsonBoolObj (json_t *ParentJsonObj, char *Key,
> RedfishCS_bool *BoolValue);
> +RedfishCS_status InsertJsonStringArrayObj (json_t *JsonObj, char *Key,
> RedfishCS_char_Array *StringValueArray);
> +RedfishCS_status InsertJsonLinkArrayObj (json_t *JsonObj, char *Key,
> RedfishCS_Link *LinkArray);
> +RedfishCS_status InsertJsonInt64ArrayObj (json_t *ParentJsonObj, char *Key,
> RedfishCS_int64_Array *Int64ValueArray);
> +RedfishCS_status InsertJsonBoolArrayObj (json_t *ParentJsonObj, char *Key,
> RedfishCS_bool_Array *BoolValueArray);
> +RedfishCS_status InsertJsonVagueObj (json_t *ParentJsonObj, char *Key,
> RedfishCS_Vague *VagueValue);
> +RedfishCS_bool CheckEmptyPropJsonObject(json_t *JsonObj, RedfishCS_uint32
> *NumOfProperty);
> +RedfishCS_status CreateEmptyPropCsJson(RedfishCS_void *Cs, json_t *JsonOj,
> RedfishCS_char *NodeName, RedfishCS_char *ParentUri,
> RedfishCS_Type_EmptyProp_CS_Data **CsTypeEmptyPropCS, RedfishCS_uint32
> NunmOfProperties);
> +RedfishCS_status CsEmptyPropLinkToJson(json_t *CsJson, char *Key,
> RedfishCS_Link *Link);
> +
> +//
> +//Generate C structure for #Bios.ChangePassword
> +//
> +static RedfishCS_status GenChangePasswordCs(RedfishBios_V1_0_9_Bios_CS
> *Cs, json_t *JsonObj, char *Key, RedfishBios_V1_0_9_ChangePassword_CS
> **Dst)
> +{
> + RedfishCS_status Status;
> + json_t *TempJsonObj;
> +
> + Status = RedfishCS_status_success;
> + TempJsonObj = json_object_get(JsonObj, Key);
> + if (TempJsonObj == NULL) {
> + return RedfishCS_status_not_found;
> + }
> + Status = allocateRecordCsMemory(Cs,
> sizeof(RedfishBios_V1_0_9_ChangePassword_CS), (RedfishCS_void **)Dst);
> + if (Status != RedfishCS_status_success){
> + goto Error;
> + }
> + // target
> + Status = GetRedfishPropertyStr (Cs, TempJsonObj, "target", &(*Dst)->target);
> + if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> + else {if (Status == RedfishCS_status_not_found){/*This is not the required
> property.*/}}
> +
> + // title
> + Status = GetRedfishPropertyStr (Cs, TempJsonObj, "title", &(*Dst)->title);
> + if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> + else {if (Status == RedfishCS_status_not_found){/*This is not the required
> property.*/}}
> +
> +Error:;
> + return Status;
> +}
> +//
> +//Generate C structure for #Bios.ResetBios
> +//
> +static RedfishCS_status GenResetBiosCs(RedfishBios_V1_0_9_Bios_CS *Cs,
> json_t *JsonObj, char *Key, RedfishBios_V1_0_9_ResetBios_CS **Dst)
> +{
> + RedfishCS_status Status;
> + json_t *TempJsonObj;
> +
> + Status = RedfishCS_status_success;
> + TempJsonObj = json_object_get(JsonObj, Key);
> + if (TempJsonObj == NULL) {
> + return RedfishCS_status_not_found;
> + }
> + Status = allocateRecordCsMemory(Cs,
> sizeof(RedfishBios_V1_0_9_ResetBios_CS), (RedfishCS_void **)Dst);
> + if (Status != RedfishCS_status_success){
> + goto Error;
> + }
> + // target
> + Status = GetRedfishPropertyStr (Cs, TempJsonObj, "target", &(*Dst)->target);
> + if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> + else {if (Status == RedfishCS_status_not_found){/*This is not the required
> property.*/}}
> +
> + // title
> + Status = GetRedfishPropertyStr (Cs, TempJsonObj, "title", &(*Dst)->title);
> + if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> + else {if (Status == RedfishCS_status_not_found){/*This is not the required
> property.*/}}
> +
> +Error:;
> + return Status;
> +}
> +//
> +//Generate C structure for Oem
> +//
> +static RedfishCS_status GenOemActionsCs(RedfishBios_V1_0_9_Bios_CS *Cs,
> json_t *JsonObj, char *Key, RedfishBios_V1_0_9_OemActions_CS **Dst)
> +{
> + RedfishCS_status Status;
> + RedfishCS_Type_JSON_Data *CsTypeJson;
> + RedfishCS_Type_EmptyProp_CS_Data *CsTypeEmptyPropCS;
> + RedfishCS_uint32 NunmOfEmptyPropProperties;
> + json_t *TempJsonObj;
> +
> + Status = RedfishCS_status_success;
> + TempJsonObj = json_object_get(JsonObj, Key);
> + if (TempJsonObj == NULL) {
> + return RedfishCS_status_not_found;
> + }
> + Status = allocateRecordCsMemory(Cs,
> sizeof(RedfishBios_V1_0_9_OemActions_CS), (RedfishCS_void **)Dst);
> + if (Status != RedfishCS_status_success){
> + goto Error;
> + }
> + InitializeLinkHead (&(*Dst)->Prop);
> +
> + //
> + // Try to create C structure if the property is
> + // declared as empty property in schema. The supported property type
> + // is string, integer, real, number and boolean.
> + //
> + if (CheckEmptyPropJsonObject(TempJsonObj, &NunmOfEmptyPropProperties))
> {
> + Status = CreateEmptyPropCsJson(Cs, JsonObj, Key, Cs->Header.ThisUri,
> &CsTypeEmptyPropCS, NunmOfEmptyPropProperties);
> + if (Status != RedfishCS_status_success) {
> + goto Error;
> + }
> + InsertTailLink(&(*Dst)->Prop, &CsTypeEmptyPropCS->Header.LinkEntry);
> + } else {
> + Status = CreateCsJsonByNode (Cs, JsonObj, Key, Cs->Header.ThisUri,
> &CsTypeJson);
> + if (Status != RedfishCS_status_success) {
> + goto Error;
> + }
> + InsertTailLink(&(*Dst)->Prop, &CsTypeJson->Header.LinkEntry);
> + }
> +Error:;
> + return Status;
> +}
> +//
> +//Generate C structure for Actions
> +//
> +static RedfishCS_status GenActionsCs(RedfishBios_V1_0_9_Bios_CS *Cs, json_t
> *JsonObj, char *Key, RedfishBios_V1_0_9_Actions_CS **Dst)
> +{
> + RedfishCS_status Status;
> + json_t *TempJsonObj;
> +
> + Status = RedfishCS_status_success;
> + TempJsonObj = json_object_get(JsonObj, Key);
> + if (TempJsonObj == NULL) {
> + return RedfishCS_status_not_found;
> + }
> + Status = allocateRecordCsMemory(Cs, sizeof(RedfishBios_V1_0_9_Actions_CS),
> (RedfishCS_void **)Dst);
> + if (Status != RedfishCS_status_success){
> + goto Error;
> + }
> + // #Bios.ChangePassword
> + Status = GenChangePasswordCs (Cs, TempJsonObj, "#Bios.ChangePassword",
> &(*Dst)->Bios_ChangePassword);
> + if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> + else {if (Status == RedfishCS_status_not_found){/*This is not the required
> property.*/}}
> +
> + // #Bios.ResetBios
> + Status = GenResetBiosCs (Cs, TempJsonObj, "#Bios.ResetBios", &(*Dst)-
> >Bios_ResetBios);
> + if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> + else {if (Status == RedfishCS_status_not_found){/*This is not the required
> property.*/}}
> +
> + // Oem
> + Status = GenOemActionsCs (Cs, TempJsonObj, "Oem", &(*Dst)->Oem);
> + if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> + else {if (Status == RedfishCS_status_not_found){/*This is not the required
> property.*/}}
> +
> +Error:;
> + return Status;
> +}
> +//
> +//Generate C structure for Attributes
> +//
> +static RedfishCS_status GenAttributesCs(RedfishBios_V1_0_9_Bios_CS *Cs,
> json_t *JsonObj, char *Key, RedfishBios_V1_0_9_Attributes_CS **Dst)
> +{
> + RedfishCS_status Status;
> + RedfishCS_Type_JSON_Data *CsTypeJson;
> + RedfishCS_Type_EmptyProp_CS_Data *CsTypeEmptyPropCS;
> + RedfishCS_uint32 NunmOfEmptyPropProperties;
> + json_t *TempJsonObj;
> +
> + Status = RedfishCS_status_success;
> + TempJsonObj = json_object_get(JsonObj, Key);
> + if (TempJsonObj == NULL) {
> + return RedfishCS_status_not_found;
> + }
> + Status = allocateRecordCsMemory(Cs,
> sizeof(RedfishBios_V1_0_9_Attributes_CS), (RedfishCS_void **)Dst);
> + if (Status != RedfishCS_status_success){
> + goto Error;
> + }
> + InitializeLinkHead (&(*Dst)->Prop);
> +
> + //
> + // Try to create C structure if the property is
> + // declared as empty property in schema. The supported property type
> + // is string, integer, real, number and boolean.
> + //
> + if (CheckEmptyPropJsonObject(TempJsonObj, &NunmOfEmptyPropProperties))
> {
> + Status = CreateEmptyPropCsJson(Cs, JsonObj, Key, Cs->Header.ThisUri,
> &CsTypeEmptyPropCS, NunmOfEmptyPropProperties);
> + if (Status != RedfishCS_status_success) {
> + goto Error;
> + }
> + InsertTailLink(&(*Dst)->Prop, &CsTypeEmptyPropCS->Header.LinkEntry);
> + } else {
> + Status = CreateCsJsonByNode (Cs, JsonObj, Key, Cs->Header.ThisUri,
> &CsTypeJson);
> + if (Status != RedfishCS_status_success) {
> + goto Error;
> + }
> + InsertTailLink(&(*Dst)->Prop, &CsTypeJson->Header.LinkEntry);
> + }
> +Error:;
> + return Status;
> +}
> +//
> +//Generate C structure for Oem
> +//
> +static RedfishCS_status GenOemCs(RedfishBios_V1_0_9_Bios_CS *Cs, json_t
> *JsonObj, char *Key, RedfishResource_Oem_CS **Dst)
> +{
> + RedfishCS_status Status;
> + RedfishCS_Type_JSON_Data *CsTypeJson;
> + RedfishCS_Type_EmptyProp_CS_Data *CsTypeEmptyPropCS;
> + RedfishCS_uint32 NunmOfEmptyPropProperties;
> + json_t *TempJsonObj;
> +
> + Status = RedfishCS_status_success;
> + TempJsonObj = json_object_get(JsonObj, Key);
> + if (TempJsonObj == NULL) {
> + return RedfishCS_status_not_found;
> + }
> + Status = allocateRecordCsMemory(Cs, sizeof(RedfishResource_Oem_CS),
> (RedfishCS_void **)Dst);
> + if (Status != RedfishCS_status_success){
> + goto Error;
> + }
> + InitializeLinkHead (&(*Dst)->Prop);
> +
> + //
> + // Try to create C structure if the property is
> + // declared as empty property in schema. The supported property type
> + // is string, integer, real, number and boolean.
> + //
> + if (CheckEmptyPropJsonObject(TempJsonObj, &NunmOfEmptyPropProperties))
> {
> + Status = CreateEmptyPropCsJson(Cs, JsonObj, Key, Cs->Header.ThisUri,
> &CsTypeEmptyPropCS, NunmOfEmptyPropProperties);
> + if (Status != RedfishCS_status_success) {
> + goto Error;
> + }
> + InsertTailLink(&(*Dst)->Prop, &CsTypeEmptyPropCS->Header.LinkEntry);
> + } else {
> + Status = CreateCsJsonByNode (Cs, JsonObj, Key, Cs->Header.ThisUri,
> &CsTypeJson);
> + if (Status != RedfishCS_status_success) {
> + goto Error;
> + }
> + InsertTailLink(&(*Dst)->Prop, &CsTypeJson->Header.LinkEntry);
> + }
> +Error:;
> + return Status;
> +}
> +static RedfishCS_status CS_To_JSON_ActionsBios_ChangePassword(json_t
> *CsJson, char *Key, RedfishBios_V1_0_9_ChangePassword_CS *CSPtr)
> +{
> + json_t *CsParentJson;
> +
> + if (CSPtr == NULL) {
> + return RedfishCS_status_success;
> + }
> +
> + CsParentJson = CsJson;
> + CsJson = json_object();
> + if (CsJson == NULL) {
> + return RedfishCS_status_unsupported;
> + }
> +
> + // target
> + if (InsertJsonStringObj (CsJson, "target", CSPtr->target) !=
> RedfishCS_status_success) {goto Error;}
> +
> + // title
> + if (InsertJsonStringObj (CsJson, "title", CSPtr->title) !=
> RedfishCS_status_success) {goto Error;}
> +
> + // Set to parent JSON object.
> + if (json_object_set_new (CsParentJson, Key, CsJson) == -1) {goto Error;}
> +
> + return RedfishCS_status_success;
> +Error:;
> + return RedfishCS_status_unsupported;
> +}
> +static RedfishCS_status CS_To_JSON_ActionsBios_ResetBios(json_t *CsJson,
> char *Key, RedfishBios_V1_0_9_ResetBios_CS *CSPtr)
> +{
> + json_t *CsParentJson;
> +
> + if (CSPtr == NULL) {
> + return RedfishCS_status_success;
> + }
> +
> + CsParentJson = CsJson;
> + CsJson = json_object();
> + if (CsJson == NULL) {
> + return RedfishCS_status_unsupported;
> + }
> +
> + // target
> + if (InsertJsonStringObj (CsJson, "target", CSPtr->target) !=
> RedfishCS_status_success) {goto Error;}
> +
> + // title
> + if (InsertJsonStringObj (CsJson, "title", CSPtr->title) !=
> RedfishCS_status_success) {goto Error;}
> +
> + // Set to parent JSON object.
> + if (json_object_set_new (CsParentJson, Key, CsJson) == -1) {goto Error;}
> +
> + return RedfishCS_status_success;
> +Error:;
> + return RedfishCS_status_unsupported;
> +}
> +static RedfishCS_status CS_To_JSON_ActionsOem(json_t *CsJson, char *Key,
> RedfishBios_V1_0_9_OemActions_CS *CSPtr)
> +{
> + json_t *CsParentJson;
> +
> + if (CSPtr == NULL) {
> + return RedfishCS_status_success;
> + }
> +
> + CsParentJson = CsJson;
> + CsJson = json_object();
> + if (CsJson == NULL) {
> + return RedfishCS_status_unsupported;
> + }
> +
> + // Check if this is RedfishCS_Type_CS_EmptyProp.
> + CsEmptyPropLinkToJson(CsJson, Key, &CSPtr->Prop);
> + // No JSON property for this structure.
> + return RedfishCS_status_success;
> +}
> +static RedfishCS_status CS_To_JSON_Actions(json_t *CsJson, char *Key,
> RedfishBios_V1_0_9_Actions_CS *CSPtr)
> +{
> + json_t *CsParentJson;
> +
> + if (CSPtr == NULL) {
> + return RedfishCS_status_success;
> + }
> +
> + CsParentJson = CsJson;
> + CsJson = json_object();
> + if (CsJson == NULL) {
> + return RedfishCS_status_unsupported;
> + }
> +
> + // #Bios.ChangePassword
> + if (CS_To_JSON_ActionsBios_ChangePassword(CsJson,
> "#Bios.ChangePassword", CSPtr->Bios_ChangePassword) !=
> RedfishCS_status_success) {goto Error;}
> +
> + // #Bios.ResetBios
> + if (CS_To_JSON_ActionsBios_ResetBios(CsJson, "#Bios.ResetBios", CSPtr-
> >Bios_ResetBios) != RedfishCS_status_success) {goto Error;}
> +
> + // Oem
> + if (CS_To_JSON_ActionsOem(CsJson, "Oem", CSPtr->Oem) !=
> RedfishCS_status_success) {goto Error;}
> +
> + // Set to parent JSON object.
> + if (json_object_set_new (CsParentJson, Key, CsJson) == -1) {goto Error;}
> +
> + return RedfishCS_status_success;
> +Error:;
> + return RedfishCS_status_unsupported;
> +}
> +static RedfishCS_status CS_To_JSON_Attributes(json_t *CsJson, char *Key,
> RedfishBios_V1_0_9_Attributes_CS *CSPtr)
> +{
> + //json_t *CsParentJson;
> +
> + if (CSPtr == NULL) {
> + return RedfishCS_status_success;
> + }
> +
> + //CsParentJson = CsJson;
> + //CsJson = json_object();
> + //if (CsJson == NULL) {
> + // return RedfishCS_status_unsupported;
> + //}
> +
> + // Check if this is RedfishCS_Type_CS_EmptyProp.
> + CsEmptyPropLinkToJson(CsJson, Key, &CSPtr->Prop);
> + // No JSON property for this structure.
> + return RedfishCS_status_success;
> +}
> +static RedfishCS_status CS_To_JSON_Oem(json_t *CsJson, char *Key,
> RedfishResource_Oem_CS *CSPtr)
> +{
> + json_t *CsParentJson;
> +
> + if (CSPtr == NULL) {
> + return RedfishCS_status_success;
> + }
> +
> + CsParentJson = CsJson;
> + CsJson = json_object();
> + if (CsJson == NULL) {
> + return RedfishCS_status_unsupported;
> + }
> +
> + // Check if this is RedfishCS_Type_CS_EmptyProp.
> + CsEmptyPropLinkToJson(CsJson, Key, &CSPtr->Prop);
> + // No JSON property for this structure.
> + return RedfishCS_status_success;
> +}
> +
> +//
> +// C structure to JSON for Bios.V1_0_9.Bios
> +//
> +RedfishCS_status CS_To_Bios_V1_0_9_JSON(RedfishBios_V1_0_9_Bios_CS
> *CSPtr, RedfishCS_char **JsonText)
> +{
> + json_t *CsJson;
> +
> + if (CSPtr == NULL || JsonText == NULL || CSPtr->Header.ResourceType !=
> RedfishCS_Type_CS) {
> + return RedfishCS_status_invalid_parameter;
> + }
> + CsJson = json_object();
> + if (CsJson == NULL) {
> + return RedfishCS_status_unsupported;
> + }
> + // Actions
> + if (CS_To_JSON_Actions(CsJson, "Actions", CSPtr->Actions) !=
> RedfishCS_status_success) {goto Error;}
> +
> + // AttributeRegistry
> + if (InsertJsonStringObj (CsJson, "AttributeRegistry", CSPtr->AttributeRegistry) !=
> RedfishCS_status_success) {goto Error;}
> +
> + // Attributes
> + if (CS_To_JSON_Attributes(CsJson, "Attributes", CSPtr->Attributes) !=
> RedfishCS_status_success) {goto Error;}
> +
> + // Description
> + if (InsertJsonStringObj (CsJson, "Description", CSPtr->Description) !=
> RedfishCS_status_success) {goto Error;}
> +
> + // Id
> + if (InsertJsonStringObj (CsJson, "Id", CSPtr->Id) != RedfishCS_status_success)
> {goto Error;}
> +
> + // Name
> + if (InsertJsonStringObj (CsJson, "Name", CSPtr->Name) !=
> RedfishCS_status_success) {goto Error;}
> +
> + // Oem
> + if (CS_To_JSON_Oem(CsJson, "Oem", CSPtr->Oem) !=
> RedfishCS_status_success) {goto Error;}
> +
> + // @odata.context
> + if (InsertJsonStringObj (CsJson, "@odata.context", CSPtr->odata_context) !=
> RedfishCS_status_success) {goto Error;}
> +
> + // @odata.etag
> + if (InsertJsonStringObj (CsJson, "@odata.etag", CSPtr->odata_etag) !=
> RedfishCS_status_success) {goto Error;}
> +
> + // @odata.id
> + if (InsertJsonStringObj (CsJson, "@odata.id", CSPtr->odata_id) !=
> RedfishCS_status_success) {goto Error;}
> +
> + // @odata.type
> + if (InsertJsonStringObj (CsJson, "@odata.type", CSPtr->odata_type) !=
> RedfishCS_status_success) {goto Error;}
> +
> + *JsonText = (RedfishCS_char *)json_dumps(CsJson, JSON_INDENT(2 * 1) |
> JSON_ENSURE_ASCII);
> + json_decref(CsJson);
> + return RedfishCS_status_success;
> +Error:;
> + json_decref(CsJson);
> + return RedfishCS_status_unsupported;
> +}
> +
> +//
> +// Destory C Structure for Bios.V1_0_9.Bios
> +//
> +RedfishCS_status DestroyBios_V1_0_9_CS(RedfishBios_V1_0_9_Bios_CS *CSPtr)
> +{
> + RedfishCS_status Status;
> +
> + Status = DestoryCsMemory ((RedfishCS_void *)CSPtr);
> + return Status;
> +}
> +
> +//
> +// Destory JSON text for Bios.V1_0_9.Bios
> +//
> +RedfishCS_status DestroyBios_V1_0_9_Json(RedfishCS_char *JsonText)
> +{
> + free ((RedfishCS_void *)JsonText);
> + return RedfishCS_status_success;
> +}
> +
> +//
> +//Generate C structure for Bios.V1_0_9.Bios
> +//
> +RedfishCS_status
> +Json_Bios_V1_0_9_To_CS(RedfishCS_char *JsonRawText,
> RedfishBios_V1_0_9_Bios_CS **ReturnedCs)
> +{
> + RedfishCS_status Status;
> + json_t *JsonObj;
> + RedfishBios_V1_0_9_Bios_CS *Cs;
> +
> + Status = CreateJsonPayloadAndCs (JsonRawText, "Bios", "v1_0_9", "Bios",
> &JsonObj, (RedfishCS_void **)&Cs, sizeof (RedfishBios_V1_0_9_Bios_CS));
> + if (Status != RedfishCS_status_success) {
> + goto Error;
> + }
> +
> + // @odata.context
> + Status = GetRedfishPropertyStr (Cs, JsonObj, "@odata.context", &Cs-
> >odata_context);
> + if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> + else {if (Status == RedfishCS_status_not_found){/*This is not the required
> property.*/}}
> +
> + // @odata.etag
> + Status = GetRedfishPropertyStr (Cs, JsonObj, "@odata.etag", &Cs-
> >odata_etag);
> + if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> + else {if (Status == RedfishCS_status_not_found){/*This is not the required
> property.*/}}
> +
> + // @odata.id
> + Status = GetRedfishPropertyStr (Cs, JsonObj, "@odata.id", &Cs->odata_id);
> + if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> + else {if (Status == RedfishCS_status_not_found){goto Error;}}
> +
> + // @odata.type
> + Status = GetRedfishPropertyStr (Cs, JsonObj, "@odata.type", &Cs->odata_type);
> + if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> + else {if (Status == RedfishCS_status_not_found){goto Error;}}
> +
> + // Actions
> + Status = GenActionsCs (Cs, JsonObj, "Actions", &Cs->Actions);
> + if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> + else {if (Status == RedfishCS_status_not_found){/*This is not the required
> property.*/}}
> +
> + // AttributeRegistry
> + Status = GetRedfishPropertyStr (Cs, JsonObj, "AttributeRegistry", &Cs-
> >AttributeRegistry);
> + if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> + else {if (Status == RedfishCS_status_not_found){/*This is not the required
> property.*/}}
> +
> + // Attributes
> + Status = GenAttributesCs (Cs, JsonObj, "Attributes", &Cs->Attributes);
> + if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> + else {if (Status == RedfishCS_status_not_found){/*This is not the required
> property.*/}}
> +
> + // Description
> + Status = GetRedfishPropertyStr (Cs, JsonObj, "Description", &Cs->Description);
> + if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> + else {if (Status == RedfishCS_status_not_found){/*This is not the required
> property.*/}}
> +
> + // Id
> + Status = GetRedfishPropertyStr (Cs, JsonObj, "Id", &Cs->Id);
> + if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> + else {if (Status == RedfishCS_status_not_found){goto Error;}}
> +
> + // Name
> + Status = GetRedfishPropertyStr (Cs, JsonObj, "Name", &Cs->Name);
> + if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> + else {if (Status == RedfishCS_status_not_found){goto Error;}}
> +
> + // Oem
> + Status = GenOemCs (Cs, JsonObj, "Oem", &Cs->Oem);
> + if (Status != RedfishCS_status_success && Status !=
> RedfishCS_status_not_found) {goto Error;}
> + else {if (Status == RedfishCS_status_not_found){/*This is not the required
> property.*/}}
> +
> + json_decref(JsonObj);
> + *ReturnedCs = Cs;
> + return RedfishCS_status_success;
> +Error:;
> + json_decref(JsonObj);
> + DestroyBios_V1_0_9_CS (Cs);
> + return Status;
> +}
> --
> 2.37.1.windows.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-05-11 1:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-11 0:57 [edk2-redfish-client][PATCH] RedfishClientPkg: Update Redfish converter lib Chang, Abner
2023-05-11 1:04 ` Nickle Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox