mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-04 22:30:09 +00:00
Add AUSF, UDM, and UDR
This commit is contained in:
parent
0c0241d5e5
commit
72370ff0b2
1151 changed files with 140173 additions and 24799 deletions
106
lib/sbi/openapi/model/rm_info.c
Normal file
106
lib/sbi/openapi/model/rm_info.c
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "rm_info.h"
|
||||
|
||||
OpenAPI_rm_info_t *OpenAPI_rm_info_create(
|
||||
OpenAPI_rm_state_t *rm_state,
|
||||
OpenAPI_access_type_e access_type
|
||||
)
|
||||
{
|
||||
OpenAPI_rm_info_t *rm_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_rm_info_t));
|
||||
if (!rm_info_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
rm_info_local_var->rm_state = rm_state;
|
||||
rm_info_local_var->access_type = access_type;
|
||||
|
||||
return rm_info_local_var;
|
||||
}
|
||||
|
||||
void OpenAPI_rm_info_free(OpenAPI_rm_info_t *rm_info)
|
||||
{
|
||||
if (NULL == rm_info) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_rm_state_free(rm_info->rm_state);
|
||||
ogs_free(rm_info);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_rm_info_convertToJSON(OpenAPI_rm_info_t *rm_info)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (rm_info == NULL) {
|
||||
ogs_error("OpenAPI_rm_info_convertToJSON() failed [RmInfo]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (!rm_info->rm_state) {
|
||||
ogs_error("OpenAPI_rm_info_convertToJSON() failed [rm_state]");
|
||||
goto end;
|
||||
}
|
||||
cJSON *rm_state_local_JSON = OpenAPI_rm_state_convertToJSON(rm_info->rm_state);
|
||||
if (rm_state_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_rm_info_convertToJSON() failed [rm_state]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "rmState", rm_state_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
ogs_error("OpenAPI_rm_info_convertToJSON() failed [rm_state]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!rm_info->access_type) {
|
||||
ogs_error("OpenAPI_rm_info_convertToJSON() failed [access_type]");
|
||||
goto end;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "accessType", OpenAPI_access_type_ToString(rm_info->access_type)) == NULL) {
|
||||
ogs_error("OpenAPI_rm_info_convertToJSON() failed [access_type]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_rm_info_t *OpenAPI_rm_info_parseFromJSON(cJSON *rm_infoJSON)
|
||||
{
|
||||
OpenAPI_rm_info_t *rm_info_local_var = NULL;
|
||||
cJSON *rm_state = cJSON_GetObjectItemCaseSensitive(rm_infoJSON, "rmState");
|
||||
if (!rm_state) {
|
||||
ogs_error("OpenAPI_rm_info_parseFromJSON() failed [rm_state]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_rm_state_t *rm_state_local_nonprim = NULL;
|
||||
|
||||
rm_state_local_nonprim = OpenAPI_rm_state_parseFromJSON(rm_state);
|
||||
|
||||
cJSON *access_type = cJSON_GetObjectItemCaseSensitive(rm_infoJSON, "accessType");
|
||||
if (!access_type) {
|
||||
ogs_error("OpenAPI_rm_info_parseFromJSON() failed [access_type]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_access_type_e access_typeVariable;
|
||||
|
||||
if (!cJSON_IsString(access_type)) {
|
||||
ogs_error("OpenAPI_rm_info_parseFromJSON() failed [access_type]");
|
||||
goto end;
|
||||
}
|
||||
access_typeVariable = OpenAPI_access_type_FromString(access_type->valuestring);
|
||||
|
||||
rm_info_local_var = OpenAPI_rm_info_create (
|
||||
rm_state_local_nonprim,
|
||||
access_typeVariable
|
||||
);
|
||||
|
||||
return rm_info_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue