mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-04 22:30:09 +00:00
[SBI] Crash occurs when ENUM in the MAP (#2103)
This commit is contained in:
parent
ce668c556c
commit
969c116e77
1097 changed files with 266728 additions and 42047 deletions
|
|
@ -26,24 +26,41 @@ OpenAPI_lmf_info_t *OpenAPI_lmf_info_create(
|
|||
|
||||
void OpenAPI_lmf_info_free(OpenAPI_lmf_info_t *lmf_info)
|
||||
{
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (NULL == lmf_info) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_list_for_each(lmf_info->serving_client_types, node) {
|
||||
OpenAPI_external_client_type_free(node->data);
|
||||
if (lmf_info->serving_client_types) {
|
||||
OpenAPI_list_for_each(lmf_info->serving_client_types, node) {
|
||||
OpenAPI_external_client_type_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(lmf_info->serving_client_types);
|
||||
lmf_info->serving_client_types = NULL;
|
||||
}
|
||||
if (lmf_info->lmf_id) {
|
||||
ogs_free(lmf_info->lmf_id);
|
||||
lmf_info->lmf_id = NULL;
|
||||
}
|
||||
if (lmf_info->serving_access_types) {
|
||||
OpenAPI_list_free(lmf_info->serving_access_types);
|
||||
lmf_info->serving_access_types = NULL;
|
||||
}
|
||||
if (lmf_info->serving_an_node_types) {
|
||||
OpenAPI_list_free(lmf_info->serving_an_node_types);
|
||||
lmf_info->serving_an_node_types = NULL;
|
||||
}
|
||||
if (lmf_info->serving_rat_types) {
|
||||
OpenAPI_list_free(lmf_info->serving_rat_types);
|
||||
lmf_info->serving_rat_types = NULL;
|
||||
}
|
||||
OpenAPI_list_free(lmf_info->serving_client_types);
|
||||
ogs_free(lmf_info->lmf_id);
|
||||
OpenAPI_list_free(lmf_info->serving_access_types);
|
||||
OpenAPI_list_free(lmf_info->serving_an_node_types);
|
||||
OpenAPI_list_free(lmf_info->serving_rat_types);
|
||||
ogs_free(lmf_info);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_lmf_info_convertToJSON(OpenAPI_lmf_info_t *lmf_info)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (lmf_info == NULL) {
|
||||
ogs_error("OpenAPI_lmf_info_convertToJSON() failed [LmfInfo]");
|
||||
|
|
@ -57,17 +74,13 @@ cJSON *OpenAPI_lmf_info_convertToJSON(OpenAPI_lmf_info_t *lmf_info)
|
|||
ogs_error("OpenAPI_lmf_info_convertToJSON() failed [serving_client_types]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *serving_client_types_node;
|
||||
if (lmf_info->serving_client_types) {
|
||||
OpenAPI_list_for_each(lmf_info->serving_client_types, serving_client_types_node) {
|
||||
cJSON *itemLocal = OpenAPI_external_client_type_convertToJSON(serving_client_types_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_lmf_info_convertToJSON() failed [serving_client_types]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(serving_client_typesList, itemLocal);
|
||||
OpenAPI_list_for_each(lmf_info->serving_client_types, node) {
|
||||
cJSON *itemLocal = OpenAPI_external_client_type_convertToJSON(node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_lmf_info_convertToJSON() failed [serving_client_types]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(serving_client_typesList, itemLocal);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -78,45 +91,42 @@ cJSON *OpenAPI_lmf_info_convertToJSON(OpenAPI_lmf_info_t *lmf_info)
|
|||
}
|
||||
}
|
||||
|
||||
if (lmf_info->serving_access_types) {
|
||||
cJSON *serving_access_types = cJSON_AddArrayToObject(item, "servingAccessTypes");
|
||||
if (serving_access_types == NULL) {
|
||||
if (lmf_info->serving_access_types != OpenAPI_access_type_NULL) {
|
||||
cJSON *serving_access_typesList = cJSON_AddArrayToObject(item, "servingAccessTypes");
|
||||
if (serving_access_typesList == NULL) {
|
||||
ogs_error("OpenAPI_lmf_info_convertToJSON() failed [serving_access_types]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_lnode_t *serving_access_types_node;
|
||||
OpenAPI_list_for_each(lmf_info->serving_access_types, serving_access_types_node) {
|
||||
if (cJSON_AddStringToObject(serving_access_types, "", OpenAPI_access_type_ToString((intptr_t)serving_access_types_node->data)) == NULL) {
|
||||
OpenAPI_list_for_each(lmf_info->serving_access_types, node) {
|
||||
if (cJSON_AddStringToObject(serving_access_typesList, "", OpenAPI_access_type_ToString((intptr_t)node->data)) == NULL) {
|
||||
ogs_error("OpenAPI_lmf_info_convertToJSON() failed [serving_access_types]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (lmf_info->serving_an_node_types) {
|
||||
cJSON *serving_an_node_types = cJSON_AddArrayToObject(item, "servingAnNodeTypes");
|
||||
if (serving_an_node_types == NULL) {
|
||||
if (lmf_info->serving_an_node_types != OpenAPI_an_node_type_NULL) {
|
||||
cJSON *serving_an_node_typesList = cJSON_AddArrayToObject(item, "servingAnNodeTypes");
|
||||
if (serving_an_node_typesList == NULL) {
|
||||
ogs_error("OpenAPI_lmf_info_convertToJSON() failed [serving_an_node_types]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_lnode_t *serving_an_node_types_node;
|
||||
OpenAPI_list_for_each(lmf_info->serving_an_node_types, serving_an_node_types_node) {
|
||||
if (cJSON_AddStringToObject(serving_an_node_types, "", OpenAPI_an_node_type_ToString((intptr_t)serving_an_node_types_node->data)) == NULL) {
|
||||
OpenAPI_list_for_each(lmf_info->serving_an_node_types, node) {
|
||||
if (cJSON_AddStringToObject(serving_an_node_typesList, "", OpenAPI_an_node_type_ToString((intptr_t)node->data)) == NULL) {
|
||||
ogs_error("OpenAPI_lmf_info_convertToJSON() failed [serving_an_node_types]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (lmf_info->serving_rat_types) {
|
||||
cJSON *serving_rat_types = cJSON_AddArrayToObject(item, "servingRatTypes");
|
||||
if (serving_rat_types == NULL) {
|
||||
if (lmf_info->serving_rat_types != OpenAPI_rat_type_NULL) {
|
||||
cJSON *serving_rat_typesList = cJSON_AddArrayToObject(item, "servingRatTypes");
|
||||
if (serving_rat_typesList == NULL) {
|
||||
ogs_error("OpenAPI_lmf_info_convertToJSON() failed [serving_rat_types]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_lnode_t *serving_rat_types_node;
|
||||
OpenAPI_list_for_each(lmf_info->serving_rat_types, serving_rat_types_node) {
|
||||
if (cJSON_AddStringToObject(serving_rat_types, "", OpenAPI_rat_type_ToString((intptr_t)serving_rat_types_node->data)) == NULL) {
|
||||
OpenAPI_list_for_each(lmf_info->serving_rat_types, node) {
|
||||
if (cJSON_AddStringToObject(serving_rat_typesList, "", OpenAPI_rat_type_ToString((intptr_t)node->data)) == NULL) {
|
||||
ogs_error("OpenAPI_lmf_info_convertToJSON() failed [serving_rat_types]");
|
||||
goto end;
|
||||
}
|
||||
|
|
@ -130,113 +140,109 @@ end:
|
|||
OpenAPI_lmf_info_t *OpenAPI_lmf_info_parseFromJSON(cJSON *lmf_infoJSON)
|
||||
{
|
||||
OpenAPI_lmf_info_t *lmf_info_local_var = NULL;
|
||||
cJSON *serving_client_types = cJSON_GetObjectItemCaseSensitive(lmf_infoJSON, "servingClientTypes");
|
||||
|
||||
OpenAPI_list_t *serving_client_typesList;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *serving_client_types = NULL;
|
||||
OpenAPI_list_t *serving_client_typesList = NULL;
|
||||
cJSON *lmf_id = NULL;
|
||||
cJSON *serving_access_types = NULL;
|
||||
OpenAPI_list_t *serving_access_typesList = NULL;
|
||||
cJSON *serving_an_node_types = NULL;
|
||||
OpenAPI_list_t *serving_an_node_typesList = NULL;
|
||||
cJSON *serving_rat_types = NULL;
|
||||
OpenAPI_list_t *serving_rat_typesList = NULL;
|
||||
serving_client_types = cJSON_GetObjectItemCaseSensitive(lmf_infoJSON, "servingClientTypes");
|
||||
if (serving_client_types) {
|
||||
cJSON *serving_client_types_local_nonprimitive;
|
||||
if (!cJSON_IsArray(serving_client_types)){
|
||||
ogs_error("OpenAPI_lmf_info_parseFromJSON() failed [serving_client_types]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
serving_client_typesList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(serving_client_types_local_nonprimitive, serving_client_types ) {
|
||||
if (!cJSON_IsObject(serving_client_types_local_nonprimitive)) {
|
||||
cJSON *serving_client_types_local = NULL;
|
||||
if (!cJSON_IsArray(serving_client_types)) {
|
||||
ogs_error("OpenAPI_lmf_info_parseFromJSON() failed [serving_client_types]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_external_client_type_t *serving_client_typesItem = OpenAPI_external_client_type_parseFromJSON(serving_client_types_local_nonprimitive);
|
||||
|
||||
if (!serving_client_typesItem) {
|
||||
ogs_error("No serving_client_typesItem");
|
||||
OpenAPI_list_free(serving_client_typesList);
|
||||
goto end;
|
||||
serving_client_typesList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(serving_client_types_local, serving_client_types) {
|
||||
if (!cJSON_IsObject(serving_client_types_local)) {
|
||||
ogs_error("OpenAPI_lmf_info_parseFromJSON() failed [serving_client_types]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_external_client_type_t *serving_client_typesItem = OpenAPI_external_client_type_parseFromJSON(serving_client_types_local);
|
||||
if (!serving_client_typesItem) {
|
||||
ogs_error("No serving_client_typesItem");
|
||||
OpenAPI_list_free(serving_client_typesList);
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(serving_client_typesList, serving_client_typesItem);
|
||||
}
|
||||
|
||||
OpenAPI_list_add(serving_client_typesList, serving_client_typesItem);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *lmf_id = cJSON_GetObjectItemCaseSensitive(lmf_infoJSON, "lmfId");
|
||||
|
||||
lmf_id = cJSON_GetObjectItemCaseSensitive(lmf_infoJSON, "lmfId");
|
||||
if (lmf_id) {
|
||||
if (!cJSON_IsString(lmf_id)) {
|
||||
if (!cJSON_IsString(lmf_id) && !cJSON_IsNull(lmf_id)) {
|
||||
ogs_error("OpenAPI_lmf_info_parseFromJSON() failed [lmf_id]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *serving_access_types = cJSON_GetObjectItemCaseSensitive(lmf_infoJSON, "servingAccessTypes");
|
||||
|
||||
OpenAPI_list_t *serving_access_typesList;
|
||||
serving_access_types = cJSON_GetObjectItemCaseSensitive(lmf_infoJSON, "servingAccessTypes");
|
||||
if (serving_access_types) {
|
||||
cJSON *serving_access_types_local_nonprimitive;
|
||||
if (!cJSON_IsArray(serving_access_types)) {
|
||||
ogs_error("OpenAPI_lmf_info_parseFromJSON() failed [serving_access_types]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
serving_access_typesList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(serving_access_types_local_nonprimitive, serving_access_types ) {
|
||||
if (!cJSON_IsString(serving_access_types_local_nonprimitive)){
|
||||
cJSON *serving_access_types_local = NULL;
|
||||
if (!cJSON_IsArray(serving_access_types)) {
|
||||
ogs_error("OpenAPI_lmf_info_parseFromJSON() failed [serving_access_types]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_list_add(serving_access_typesList, (void *)OpenAPI_access_type_FromString(serving_access_types_local_nonprimitive->valuestring));
|
||||
}
|
||||
serving_access_typesList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(serving_access_types_local, serving_access_types) {
|
||||
if (!cJSON_IsString(serving_access_types_local)) {
|
||||
ogs_error("OpenAPI_lmf_info_parseFromJSON() failed [serving_access_types]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(serving_access_typesList, (void *)OpenAPI_access_type_FromString(serving_access_types_local->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *serving_an_node_types = cJSON_GetObjectItemCaseSensitive(lmf_infoJSON, "servingAnNodeTypes");
|
||||
|
||||
OpenAPI_list_t *serving_an_node_typesList;
|
||||
serving_an_node_types = cJSON_GetObjectItemCaseSensitive(lmf_infoJSON, "servingAnNodeTypes");
|
||||
if (serving_an_node_types) {
|
||||
cJSON *serving_an_node_types_local_nonprimitive;
|
||||
if (!cJSON_IsArray(serving_an_node_types)) {
|
||||
ogs_error("OpenAPI_lmf_info_parseFromJSON() failed [serving_an_node_types]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
serving_an_node_typesList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(serving_an_node_types_local_nonprimitive, serving_an_node_types ) {
|
||||
if (!cJSON_IsString(serving_an_node_types_local_nonprimitive)){
|
||||
cJSON *serving_an_node_types_local = NULL;
|
||||
if (!cJSON_IsArray(serving_an_node_types)) {
|
||||
ogs_error("OpenAPI_lmf_info_parseFromJSON() failed [serving_an_node_types]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_list_add(serving_an_node_typesList, (void *)OpenAPI_an_node_type_FromString(serving_an_node_types_local_nonprimitive->valuestring));
|
||||
}
|
||||
serving_an_node_typesList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(serving_an_node_types_local, serving_an_node_types) {
|
||||
if (!cJSON_IsString(serving_an_node_types_local)) {
|
||||
ogs_error("OpenAPI_lmf_info_parseFromJSON() failed [serving_an_node_types]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(serving_an_node_typesList, (void *)OpenAPI_an_node_type_FromString(serving_an_node_types_local->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *serving_rat_types = cJSON_GetObjectItemCaseSensitive(lmf_infoJSON, "servingRatTypes");
|
||||
|
||||
OpenAPI_list_t *serving_rat_typesList;
|
||||
serving_rat_types = cJSON_GetObjectItemCaseSensitive(lmf_infoJSON, "servingRatTypes");
|
||||
if (serving_rat_types) {
|
||||
cJSON *serving_rat_types_local_nonprimitive;
|
||||
if (!cJSON_IsArray(serving_rat_types)) {
|
||||
ogs_error("OpenAPI_lmf_info_parseFromJSON() failed [serving_rat_types]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
serving_rat_typesList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(serving_rat_types_local_nonprimitive, serving_rat_types ) {
|
||||
if (!cJSON_IsString(serving_rat_types_local_nonprimitive)){
|
||||
cJSON *serving_rat_types_local = NULL;
|
||||
if (!cJSON_IsArray(serving_rat_types)) {
|
||||
ogs_error("OpenAPI_lmf_info_parseFromJSON() failed [serving_rat_types]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_list_add(serving_rat_typesList, (void *)OpenAPI_rat_type_FromString(serving_rat_types_local_nonprimitive->valuestring));
|
||||
}
|
||||
serving_rat_typesList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(serving_rat_types_local, serving_rat_types) {
|
||||
if (!cJSON_IsString(serving_rat_types_local)) {
|
||||
ogs_error("OpenAPI_lmf_info_parseFromJSON() failed [serving_rat_types]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(serving_rat_typesList, (void *)OpenAPI_rat_type_FromString(serving_rat_types_local->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
lmf_info_local_var = OpenAPI_lmf_info_create (
|
||||
serving_client_types ? serving_client_typesList : NULL,
|
||||
lmf_id ? ogs_strdup(lmf_id->valuestring) : NULL,
|
||||
lmf_id && !cJSON_IsNull(lmf_id) ? ogs_strdup(lmf_id->valuestring) : NULL,
|
||||
serving_access_types ? serving_access_typesList : NULL,
|
||||
serving_an_node_types ? serving_an_node_typesList : NULL,
|
||||
serving_rat_types ? serving_rat_typesList : NULL
|
||||
|
|
@ -244,6 +250,25 @@ OpenAPI_lmf_info_t *OpenAPI_lmf_info_parseFromJSON(cJSON *lmf_infoJSON)
|
|||
|
||||
return lmf_info_local_var;
|
||||
end:
|
||||
if (serving_client_typesList) {
|
||||
OpenAPI_list_for_each(serving_client_typesList, node) {
|
||||
OpenAPI_external_client_type_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(serving_client_typesList);
|
||||
serving_client_typesList = NULL;
|
||||
}
|
||||
if (serving_access_typesList) {
|
||||
OpenAPI_list_free(serving_access_typesList);
|
||||
serving_access_typesList = NULL;
|
||||
}
|
||||
if (serving_an_node_typesList) {
|
||||
OpenAPI_list_free(serving_an_node_typesList);
|
||||
serving_an_node_typesList = NULL;
|
||||
}
|
||||
if (serving_rat_typesList) {
|
||||
OpenAPI_list_free(serving_rat_typesList);
|
||||
serving_rat_typesList = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue