[SBI] Crash occurs when ENUM in the MAP (#2103)

This commit is contained in:
Sukchan Lee 2023-03-01 17:50:25 +09:00
parent ce668c556c
commit 969c116e77
1097 changed files with 266728 additions and 42047 deletions

View file

@ -48,31 +48,69 @@ OpenAPI_sdm_subscription_1_t *OpenAPI_sdm_subscription_1_create(
void OpenAPI_sdm_subscription_1_free(OpenAPI_sdm_subscription_1_t *sdm_subscription_1)
{
OpenAPI_lnode_t *node = NULL;
if (NULL == sdm_subscription_1) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(sdm_subscription_1->nf_instance_id);
ogs_free(sdm_subscription_1->expires);
ogs_free(sdm_subscription_1->callback_reference);
ogs_free(sdm_subscription_1->amf_service_name);
OpenAPI_list_for_each(sdm_subscription_1->monitored_resource_uris, node) {
ogs_free(node->data);
if (sdm_subscription_1->nf_instance_id) {
ogs_free(sdm_subscription_1->nf_instance_id);
sdm_subscription_1->nf_instance_id = NULL;
}
if (sdm_subscription_1->expires) {
ogs_free(sdm_subscription_1->expires);
sdm_subscription_1->expires = NULL;
}
if (sdm_subscription_1->callback_reference) {
ogs_free(sdm_subscription_1->callback_reference);
sdm_subscription_1->callback_reference = NULL;
}
if (sdm_subscription_1->amf_service_name) {
ogs_free(sdm_subscription_1->amf_service_name);
sdm_subscription_1->amf_service_name = NULL;
}
if (sdm_subscription_1->monitored_resource_uris) {
OpenAPI_list_for_each(sdm_subscription_1->monitored_resource_uris, node) {
ogs_free(node->data);
}
OpenAPI_list_free(sdm_subscription_1->monitored_resource_uris);
sdm_subscription_1->monitored_resource_uris = NULL;
}
if (sdm_subscription_1->single_nssai) {
OpenAPI_snssai_free(sdm_subscription_1->single_nssai);
sdm_subscription_1->single_nssai = NULL;
}
if (sdm_subscription_1->dnn) {
ogs_free(sdm_subscription_1->dnn);
sdm_subscription_1->dnn = NULL;
}
if (sdm_subscription_1->subscription_id) {
ogs_free(sdm_subscription_1->subscription_id);
sdm_subscription_1->subscription_id = NULL;
}
if (sdm_subscription_1->plmn_id) {
OpenAPI_plmn_id_1_free(sdm_subscription_1->plmn_id);
sdm_subscription_1->plmn_id = NULL;
}
if (sdm_subscription_1->report) {
OpenAPI_subscription_data_sets_1_free(sdm_subscription_1->report);
sdm_subscription_1->report = NULL;
}
if (sdm_subscription_1->supported_features) {
ogs_free(sdm_subscription_1->supported_features);
sdm_subscription_1->supported_features = NULL;
}
if (sdm_subscription_1->context_info) {
OpenAPI_context_info_free(sdm_subscription_1->context_info);
sdm_subscription_1->context_info = NULL;
}
OpenAPI_list_free(sdm_subscription_1->monitored_resource_uris);
OpenAPI_snssai_free(sdm_subscription_1->single_nssai);
ogs_free(sdm_subscription_1->dnn);
ogs_free(sdm_subscription_1->subscription_id);
OpenAPI_plmn_id_1_free(sdm_subscription_1->plmn_id);
OpenAPI_subscription_data_sets_1_free(sdm_subscription_1->report);
ogs_free(sdm_subscription_1->supported_features);
OpenAPI_context_info_free(sdm_subscription_1->context_info);
ogs_free(sdm_subscription_1);
}
cJSON *OpenAPI_sdm_subscription_1_convertToJSON(OpenAPI_sdm_subscription_1_t *sdm_subscription_1)
{
cJSON *item = NULL;
OpenAPI_lnode_t *node = NULL;
if (sdm_subscription_1 == NULL) {
ogs_error("OpenAPI_sdm_subscription_1_convertToJSON() failed [SdmSubscription_1]");
@ -80,6 +118,10 @@ cJSON *OpenAPI_sdm_subscription_1_convertToJSON(OpenAPI_sdm_subscription_1_t *sd
}
item = cJSON_CreateObject();
if (!sdm_subscription_1->nf_instance_id) {
ogs_error("OpenAPI_sdm_subscription_1_convertToJSON() failed [nf_instance_id]");
return NULL;
}
if (cJSON_AddStringToObject(item, "nfInstanceId", sdm_subscription_1->nf_instance_id) == NULL) {
ogs_error("OpenAPI_sdm_subscription_1_convertToJSON() failed [nf_instance_id]");
goto end;
@ -99,6 +141,10 @@ cJSON *OpenAPI_sdm_subscription_1_convertToJSON(OpenAPI_sdm_subscription_1_t *sd
}
}
if (!sdm_subscription_1->callback_reference) {
ogs_error("OpenAPI_sdm_subscription_1_convertToJSON() failed [callback_reference]");
return NULL;
}
if (cJSON_AddStringToObject(item, "callbackReference", sdm_subscription_1->callback_reference) == NULL) {
ogs_error("OpenAPI_sdm_subscription_1_convertToJSON() failed [callback_reference]");
goto end;
@ -111,19 +157,21 @@ cJSON *OpenAPI_sdm_subscription_1_convertToJSON(OpenAPI_sdm_subscription_1_t *sd
}
}
cJSON *monitored_resource_uris = cJSON_AddArrayToObject(item, "monitoredResourceUris");
if (monitored_resource_uris == NULL) {
if (!sdm_subscription_1->monitored_resource_uris) {
ogs_error("OpenAPI_sdm_subscription_1_convertToJSON() failed [monitored_resource_uris]");
return NULL;
}
cJSON *monitored_resource_urisList = cJSON_AddArrayToObject(item, "monitoredResourceUris");
if (monitored_resource_urisList == NULL) {
ogs_error("OpenAPI_sdm_subscription_1_convertToJSON() failed [monitored_resource_uris]");
goto end;
}
OpenAPI_lnode_t *monitored_resource_uris_node;
OpenAPI_list_for_each(sdm_subscription_1->monitored_resource_uris, monitored_resource_uris_node) {
if (cJSON_AddStringToObject(monitored_resource_uris, "", (char*)monitored_resource_uris_node->data) == NULL) {
ogs_error("OpenAPI_sdm_subscription_1_convertToJSON() failed [monitored_resource_uris]");
goto end;
OpenAPI_list_for_each(sdm_subscription_1->monitored_resource_uris, node) {
if (cJSON_AddStringToObject(monitored_resource_urisList, "", (char*)node->data) == NULL) {
ogs_error("OpenAPI_sdm_subscription_1_convertToJSON() failed [monitored_resource_uris]");
goto end;
}
}
}
if (sdm_subscription_1->single_nssai) {
cJSON *single_nssai_local_JSON = OpenAPI_snssai_convertToJSON(sdm_subscription_1->single_nssai);
@ -212,19 +260,37 @@ end:
OpenAPI_sdm_subscription_1_t *OpenAPI_sdm_subscription_1_parseFromJSON(cJSON *sdm_subscription_1JSON)
{
OpenAPI_sdm_subscription_1_t *sdm_subscription_1_local_var = NULL;
cJSON *nf_instance_id = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "nfInstanceId");
OpenAPI_lnode_t *node = NULL;
cJSON *nf_instance_id = NULL;
cJSON *implicit_unsubscribe = NULL;
cJSON *expires = NULL;
cJSON *callback_reference = NULL;
cJSON *amf_service_name = NULL;
cJSON *monitored_resource_uris = NULL;
OpenAPI_list_t *monitored_resource_urisList = NULL;
cJSON *single_nssai = NULL;
OpenAPI_snssai_t *single_nssai_local_nonprim = NULL;
cJSON *dnn = NULL;
cJSON *subscription_id = NULL;
cJSON *plmn_id = NULL;
OpenAPI_plmn_id_1_t *plmn_id_local_nonprim = NULL;
cJSON *immediate_report = NULL;
cJSON *report = NULL;
OpenAPI_subscription_data_sets_1_t *report_local_nonprim = NULL;
cJSON *supported_features = NULL;
cJSON *context_info = NULL;
OpenAPI_context_info_t *context_info_local_nonprim = NULL;
nf_instance_id = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "nfInstanceId");
if (!nf_instance_id) {
ogs_error("OpenAPI_sdm_subscription_1_parseFromJSON() failed [nf_instance_id]");
goto end;
}
if (!cJSON_IsString(nf_instance_id)) {
ogs_error("OpenAPI_sdm_subscription_1_parseFromJSON() failed [nf_instance_id]");
goto end;
}
cJSON *implicit_unsubscribe = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "implicitUnsubscribe");
implicit_unsubscribe = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "implicitUnsubscribe");
if (implicit_unsubscribe) {
if (!cJSON_IsBool(implicit_unsubscribe)) {
ogs_error("OpenAPI_sdm_subscription_1_parseFromJSON() failed [implicit_unsubscribe]");
@ -232,91 +298,82 @@ OpenAPI_sdm_subscription_1_t *OpenAPI_sdm_subscription_1_parseFromJSON(cJSON *sd
}
}
cJSON *expires = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "expires");
expires = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "expires");
if (expires) {
if (!cJSON_IsString(expires)) {
if (!cJSON_IsString(expires) && !cJSON_IsNull(expires)) {
ogs_error("OpenAPI_sdm_subscription_1_parseFromJSON() failed [expires]");
goto end;
}
}
cJSON *callback_reference = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "callbackReference");
callback_reference = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "callbackReference");
if (!callback_reference) {
ogs_error("OpenAPI_sdm_subscription_1_parseFromJSON() failed [callback_reference]");
goto end;
}
if (!cJSON_IsString(callback_reference)) {
ogs_error("OpenAPI_sdm_subscription_1_parseFromJSON() failed [callback_reference]");
goto end;
}
cJSON *amf_service_name = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "amfServiceName");
amf_service_name = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "amfServiceName");
if (amf_service_name) {
if (!cJSON_IsString(amf_service_name)) {
if (!cJSON_IsString(amf_service_name) && !cJSON_IsNull(amf_service_name)) {
ogs_error("OpenAPI_sdm_subscription_1_parseFromJSON() failed [amf_service_name]");
goto end;
}
}
cJSON *monitored_resource_uris = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "monitoredResourceUris");
monitored_resource_uris = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "monitoredResourceUris");
if (!monitored_resource_uris) {
ogs_error("OpenAPI_sdm_subscription_1_parseFromJSON() failed [monitored_resource_uris]");
goto end;
}
cJSON *monitored_resource_uris_local = NULL;
if (!cJSON_IsArray(monitored_resource_uris)) {
ogs_error("OpenAPI_sdm_subscription_1_parseFromJSON() failed [monitored_resource_uris]");
goto end;
}
OpenAPI_list_t *monitored_resource_urisList;
cJSON *monitored_resource_uris_local;
if (!cJSON_IsArray(monitored_resource_uris)) {
ogs_error("OpenAPI_sdm_subscription_1_parseFromJSON() failed [monitored_resource_uris]");
goto end;
}
monitored_resource_urisList = OpenAPI_list_create();
monitored_resource_urisList = OpenAPI_list_create();
cJSON_ArrayForEach(monitored_resource_uris_local, monitored_resource_uris) {
if (!cJSON_IsString(monitored_resource_uris_local)) {
ogs_error("OpenAPI_sdm_subscription_1_parseFromJSON() failed [monitored_resource_uris]");
goto end;
}
OpenAPI_list_add(monitored_resource_urisList, ogs_strdup(monitored_resource_uris_local->valuestring));
}
cJSON_ArrayForEach(monitored_resource_uris_local, monitored_resource_uris) {
double *localDouble = NULL;
int *localInt = NULL;
if (!cJSON_IsString(monitored_resource_uris_local)) {
ogs_error("OpenAPI_sdm_subscription_1_parseFromJSON() failed [monitored_resource_uris]");
goto end;
}
OpenAPI_list_add(monitored_resource_urisList, ogs_strdup(monitored_resource_uris_local->valuestring));
}
cJSON *single_nssai = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "singleNssai");
OpenAPI_snssai_t *single_nssai_local_nonprim = NULL;
single_nssai = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "singleNssai");
if (single_nssai) {
single_nssai_local_nonprim = OpenAPI_snssai_parseFromJSON(single_nssai);
}
cJSON *dnn = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "dnn");
dnn = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "dnn");
if (dnn) {
if (!cJSON_IsString(dnn)) {
if (!cJSON_IsString(dnn) && !cJSON_IsNull(dnn)) {
ogs_error("OpenAPI_sdm_subscription_1_parseFromJSON() failed [dnn]");
goto end;
}
}
cJSON *subscription_id = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "subscriptionId");
subscription_id = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "subscriptionId");
if (subscription_id) {
if (!cJSON_IsString(subscription_id)) {
if (!cJSON_IsString(subscription_id) && !cJSON_IsNull(subscription_id)) {
ogs_error("OpenAPI_sdm_subscription_1_parseFromJSON() failed [subscription_id]");
goto end;
}
}
cJSON *plmn_id = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "plmnId");
OpenAPI_plmn_id_1_t *plmn_id_local_nonprim = NULL;
plmn_id = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "plmnId");
if (plmn_id) {
plmn_id_local_nonprim = OpenAPI_plmn_id_1_parseFromJSON(plmn_id);
}
cJSON *immediate_report = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "immediateReport");
immediate_report = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "immediateReport");
if (immediate_report) {
if (!cJSON_IsBool(immediate_report)) {
ogs_error("OpenAPI_sdm_subscription_1_parseFromJSON() failed [immediate_report]");
@ -324,25 +381,20 @@ OpenAPI_sdm_subscription_1_t *OpenAPI_sdm_subscription_1_parseFromJSON(cJSON *sd
}
}
cJSON *report = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "report");
OpenAPI_subscription_data_sets_1_t *report_local_nonprim = NULL;
report = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "report");
if (report) {
report_local_nonprim = OpenAPI_subscription_data_sets_1_parseFromJSON(report);
}
cJSON *supported_features = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "supportedFeatures");
supported_features = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "supportedFeatures");
if (supported_features) {
if (!cJSON_IsString(supported_features)) {
if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) {
ogs_error("OpenAPI_sdm_subscription_1_parseFromJSON() failed [supported_features]");
goto end;
}
}
cJSON *context_info = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "contextInfo");
OpenAPI_context_info_t *context_info_local_nonprim = NULL;
context_info = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "contextInfo");
if (context_info) {
context_info_local_nonprim = OpenAPI_context_info_parseFromJSON(context_info);
}
@ -351,23 +403,46 @@ OpenAPI_sdm_subscription_1_t *OpenAPI_sdm_subscription_1_parseFromJSON(cJSON *sd
ogs_strdup(nf_instance_id->valuestring),
implicit_unsubscribe ? true : false,
implicit_unsubscribe ? implicit_unsubscribe->valueint : 0,
expires ? ogs_strdup(expires->valuestring) : NULL,
expires && !cJSON_IsNull(expires) ? ogs_strdup(expires->valuestring) : NULL,
ogs_strdup(callback_reference->valuestring),
amf_service_name ? ogs_strdup(amf_service_name->valuestring) : NULL,
amf_service_name && !cJSON_IsNull(amf_service_name) ? ogs_strdup(amf_service_name->valuestring) : NULL,
monitored_resource_urisList,
single_nssai ? single_nssai_local_nonprim : NULL,
dnn ? ogs_strdup(dnn->valuestring) : NULL,
subscription_id ? ogs_strdup(subscription_id->valuestring) : NULL,
dnn && !cJSON_IsNull(dnn) ? ogs_strdup(dnn->valuestring) : NULL,
subscription_id && !cJSON_IsNull(subscription_id) ? ogs_strdup(subscription_id->valuestring) : NULL,
plmn_id ? plmn_id_local_nonprim : NULL,
immediate_report ? true : false,
immediate_report ? immediate_report->valueint : 0,
report ? report_local_nonprim : NULL,
supported_features ? ogs_strdup(supported_features->valuestring) : NULL,
supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL,
context_info ? context_info_local_nonprim : NULL
);
return sdm_subscription_1_local_var;
end:
if (monitored_resource_urisList) {
OpenAPI_list_for_each(monitored_resource_urisList, node) {
ogs_free(node->data);
}
OpenAPI_list_free(monitored_resource_urisList);
monitored_resource_urisList = NULL;
}
if (single_nssai_local_nonprim) {
OpenAPI_snssai_free(single_nssai_local_nonprim);
single_nssai_local_nonprim = NULL;
}
if (plmn_id_local_nonprim) {
OpenAPI_plmn_id_1_free(plmn_id_local_nonprim);
plmn_id_local_nonprim = NULL;
}
if (report_local_nonprim) {
OpenAPI_subscription_data_sets_1_free(report_local_nonprim);
report_local_nonprim = NULL;
}
if (context_info_local_nonprim) {
OpenAPI_context_info_free(context_info_local_nonprim);
context_info_local_nonprim = NULL;
}
return NULL;
}