[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

@ -66,36 +66,89 @@ OpenAPI_pdu_session_context_t *OpenAPI_pdu_session_context_create(
void OpenAPI_pdu_session_context_free(OpenAPI_pdu_session_context_t *pdu_session_context)
{
OpenAPI_lnode_t *node = NULL;
if (NULL == pdu_session_context) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(pdu_session_context->sm_context_ref);
OpenAPI_snssai_free(pdu_session_context->s_nssai);
ogs_free(pdu_session_context->dnn);
ogs_free(pdu_session_context->selected_dnn);
OpenAPI_list_for_each(pdu_session_context->allocated_ebi_list, node) {
OpenAPI_ebi_arp_mapping_free(node->data);
if (pdu_session_context->sm_context_ref) {
ogs_free(pdu_session_context->sm_context_ref);
pdu_session_context->sm_context_ref = NULL;
}
if (pdu_session_context->s_nssai) {
OpenAPI_snssai_free(pdu_session_context->s_nssai);
pdu_session_context->s_nssai = NULL;
}
if (pdu_session_context->dnn) {
ogs_free(pdu_session_context->dnn);
pdu_session_context->dnn = NULL;
}
if (pdu_session_context->selected_dnn) {
ogs_free(pdu_session_context->selected_dnn);
pdu_session_context->selected_dnn = NULL;
}
if (pdu_session_context->allocated_ebi_list) {
OpenAPI_list_for_each(pdu_session_context->allocated_ebi_list, node) {
OpenAPI_ebi_arp_mapping_free(node->data);
}
OpenAPI_list_free(pdu_session_context->allocated_ebi_list);
pdu_session_context->allocated_ebi_list = NULL;
}
if (pdu_session_context->hsmf_id) {
ogs_free(pdu_session_context->hsmf_id);
pdu_session_context->hsmf_id = NULL;
}
if (pdu_session_context->hsmf_set_id) {
ogs_free(pdu_session_context->hsmf_set_id);
pdu_session_context->hsmf_set_id = NULL;
}
if (pdu_session_context->hsmf_service_set_id) {
ogs_free(pdu_session_context->hsmf_service_set_id);
pdu_session_context->hsmf_service_set_id = NULL;
}
if (pdu_session_context->vsmf_id) {
ogs_free(pdu_session_context->vsmf_id);
pdu_session_context->vsmf_id = NULL;
}
if (pdu_session_context->vsmf_set_id) {
ogs_free(pdu_session_context->vsmf_set_id);
pdu_session_context->vsmf_set_id = NULL;
}
if (pdu_session_context->vsmf_service_set_id) {
ogs_free(pdu_session_context->vsmf_service_set_id);
pdu_session_context->vsmf_service_set_id = NULL;
}
if (pdu_session_context->ismf_id) {
ogs_free(pdu_session_context->ismf_id);
pdu_session_context->ismf_id = NULL;
}
if (pdu_session_context->ismf_set_id) {
ogs_free(pdu_session_context->ismf_set_id);
pdu_session_context->ismf_set_id = NULL;
}
if (pdu_session_context->ismf_service_set_id) {
ogs_free(pdu_session_context->ismf_service_set_id);
pdu_session_context->ismf_service_set_id = NULL;
}
if (pdu_session_context->ns_instance) {
ogs_free(pdu_session_context->ns_instance);
pdu_session_context->ns_instance = NULL;
}
if (pdu_session_context->smf_service_instance_id) {
ogs_free(pdu_session_context->smf_service_instance_id);
pdu_session_context->smf_service_instance_id = NULL;
}
if (pdu_session_context->cn_assisted_ran_para) {
OpenAPI_cn_assisted_ran_para_free(pdu_session_context->cn_assisted_ran_para);
pdu_session_context->cn_assisted_ran_para = NULL;
}
OpenAPI_list_free(pdu_session_context->allocated_ebi_list);
ogs_free(pdu_session_context->hsmf_id);
ogs_free(pdu_session_context->hsmf_set_id);
ogs_free(pdu_session_context->hsmf_service_set_id);
ogs_free(pdu_session_context->vsmf_id);
ogs_free(pdu_session_context->vsmf_set_id);
ogs_free(pdu_session_context->vsmf_service_set_id);
ogs_free(pdu_session_context->ismf_id);
ogs_free(pdu_session_context->ismf_set_id);
ogs_free(pdu_session_context->ismf_service_set_id);
ogs_free(pdu_session_context->ns_instance);
ogs_free(pdu_session_context->smf_service_instance_id);
OpenAPI_cn_assisted_ran_para_free(pdu_session_context->cn_assisted_ran_para);
ogs_free(pdu_session_context);
}
cJSON *OpenAPI_pdu_session_context_convertToJSON(OpenAPI_pdu_session_context_t *pdu_session_context)
{
cJSON *item = NULL;
OpenAPI_lnode_t *node = NULL;
if (pdu_session_context == NULL) {
ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [PduSessionContext]");
@ -108,11 +161,19 @@ cJSON *OpenAPI_pdu_session_context_convertToJSON(OpenAPI_pdu_session_context_t *
goto end;
}
if (!pdu_session_context->sm_context_ref) {
ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [sm_context_ref]");
return NULL;
}
if (cJSON_AddStringToObject(item, "smContextRef", pdu_session_context->sm_context_ref) == NULL) {
ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [sm_context_ref]");
goto end;
}
if (!pdu_session_context->s_nssai) {
ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [s_nssai]");
return NULL;
}
cJSON *s_nssai_local_JSON = OpenAPI_snssai_convertToJSON(pdu_session_context->s_nssai);
if (s_nssai_local_JSON == NULL) {
ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [s_nssai]");
@ -124,6 +185,10 @@ cJSON *OpenAPI_pdu_session_context_convertToJSON(OpenAPI_pdu_session_context_t *
goto end;
}
if (!pdu_session_context->dnn) {
ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [dnn]");
return NULL;
}
if (cJSON_AddStringToObject(item, "dnn", pdu_session_context->dnn) == NULL) {
ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [dnn]");
goto end;
@ -136,12 +201,16 @@ cJSON *OpenAPI_pdu_session_context_convertToJSON(OpenAPI_pdu_session_context_t *
}
}
if (pdu_session_context->access_type == OpenAPI_access_type_NULL) {
ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [access_type]");
return NULL;
}
if (cJSON_AddStringToObject(item, "accessType", OpenAPI_access_type_ToString(pdu_session_context->access_type)) == NULL) {
ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [access_type]");
goto end;
}
if (pdu_session_context->additional_access_type) {
if (pdu_session_context->additional_access_type != OpenAPI_access_type_NULL) {
if (cJSON_AddStringToObject(item, "additionalAccessType", OpenAPI_access_type_ToString(pdu_session_context->additional_access_type)) == NULL) {
ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [additional_access_type]");
goto end;
@ -154,17 +223,13 @@ cJSON *OpenAPI_pdu_session_context_convertToJSON(OpenAPI_pdu_session_context_t *
ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [allocated_ebi_list]");
goto end;
}
OpenAPI_lnode_t *allocated_ebi_list_node;
if (pdu_session_context->allocated_ebi_list) {
OpenAPI_list_for_each(pdu_session_context->allocated_ebi_list, allocated_ebi_list_node) {
cJSON *itemLocal = OpenAPI_ebi_arp_mapping_convertToJSON(allocated_ebi_list_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [allocated_ebi_list]");
goto end;
}
cJSON_AddItemToArray(allocated_ebi_listList, itemLocal);
OpenAPI_list_for_each(pdu_session_context->allocated_ebi_list, node) {
cJSON *itemLocal = OpenAPI_ebi_arp_mapping_convertToJSON(node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [allocated_ebi_list]");
goto end;
}
cJSON_AddItemToArray(allocated_ebi_listList, itemLocal);
}
}
@ -189,7 +254,7 @@ cJSON *OpenAPI_pdu_session_context_convertToJSON(OpenAPI_pdu_session_context_t *
}
}
if (pdu_session_context->smf_binding) {
if (pdu_session_context->smf_binding != OpenAPI_sbi_binding_level_NULL) {
if (cJSON_AddStringToObject(item, "smfBinding", OpenAPI_sbi_binding_level_ToString(pdu_session_context->smf_binding)) == NULL) {
ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [smf_binding]");
goto end;
@ -217,7 +282,7 @@ cJSON *OpenAPI_pdu_session_context_convertToJSON(OpenAPI_pdu_session_context_t *
}
}
if (pdu_session_context->vsmf_binding) {
if (pdu_session_context->vsmf_binding != OpenAPI_sbi_binding_level_NULL) {
if (cJSON_AddStringToObject(item, "vsmfBinding", OpenAPI_sbi_binding_level_ToString(pdu_session_context->vsmf_binding)) == NULL) {
ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [vsmf_binding]");
goto end;
@ -245,7 +310,7 @@ cJSON *OpenAPI_pdu_session_context_convertToJSON(OpenAPI_pdu_session_context_t *
}
}
if (pdu_session_context->ismf_binding) {
if (pdu_session_context->ismf_binding != OpenAPI_sbi_binding_level_NULL) {
if (cJSON_AddStringToObject(item, "ismfBinding", OpenAPI_sbi_binding_level_ToString(pdu_session_context->ismf_binding)) == NULL) {
ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [ismf_binding]");
goto end;
@ -293,73 +358,96 @@ end:
OpenAPI_pdu_session_context_t *OpenAPI_pdu_session_context_parseFromJSON(cJSON *pdu_session_contextJSON)
{
OpenAPI_pdu_session_context_t *pdu_session_context_local_var = NULL;
cJSON *pdu_session_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "pduSessionId");
OpenAPI_lnode_t *node = NULL;
cJSON *pdu_session_id = NULL;
cJSON *sm_context_ref = NULL;
cJSON *s_nssai = NULL;
OpenAPI_snssai_t *s_nssai_local_nonprim = NULL;
cJSON *dnn = NULL;
cJSON *selected_dnn = NULL;
cJSON *access_type = NULL;
OpenAPI_access_type_e access_typeVariable = 0;
cJSON *additional_access_type = NULL;
OpenAPI_access_type_e additional_access_typeVariable = 0;
cJSON *allocated_ebi_list = NULL;
OpenAPI_list_t *allocated_ebi_listList = NULL;
cJSON *hsmf_id = NULL;
cJSON *hsmf_set_id = NULL;
cJSON *hsmf_service_set_id = NULL;
cJSON *smf_binding = NULL;
OpenAPI_sbi_binding_level_e smf_bindingVariable = 0;
cJSON *vsmf_id = NULL;
cJSON *vsmf_set_id = NULL;
cJSON *vsmf_service_set_id = NULL;
cJSON *vsmf_binding = NULL;
OpenAPI_sbi_binding_level_e vsmf_bindingVariable = 0;
cJSON *ismf_id = NULL;
cJSON *ismf_set_id = NULL;
cJSON *ismf_service_set_id = NULL;
cJSON *ismf_binding = NULL;
OpenAPI_sbi_binding_level_e ismf_bindingVariable = 0;
cJSON *ns_instance = NULL;
cJSON *smf_service_instance_id = NULL;
cJSON *ma_pdu_session = NULL;
cJSON *cn_assisted_ran_para = NULL;
OpenAPI_cn_assisted_ran_para_t *cn_assisted_ran_para_local_nonprim = NULL;
pdu_session_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "pduSessionId");
if (!pdu_session_id) {
ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [pdu_session_id]");
goto end;
}
if (!cJSON_IsNumber(pdu_session_id)) {
ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [pdu_session_id]");
goto end;
}
cJSON *sm_context_ref = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "smContextRef");
sm_context_ref = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "smContextRef");
if (!sm_context_ref) {
ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [sm_context_ref]");
goto end;
}
if (!cJSON_IsString(sm_context_ref)) {
ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [sm_context_ref]");
goto end;
}
cJSON *s_nssai = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "sNssai");
s_nssai = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "sNssai");
if (!s_nssai) {
ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [s_nssai]");
goto end;
}
OpenAPI_snssai_t *s_nssai_local_nonprim = NULL;
s_nssai_local_nonprim = OpenAPI_snssai_parseFromJSON(s_nssai);
cJSON *dnn = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "dnn");
dnn = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "dnn");
if (!dnn) {
ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [dnn]");
goto end;
}
if (!cJSON_IsString(dnn)) {
ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [dnn]");
goto end;
}
cJSON *selected_dnn = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "selectedDnn");
selected_dnn = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "selectedDnn");
if (selected_dnn) {
if (!cJSON_IsString(selected_dnn)) {
if (!cJSON_IsString(selected_dnn) && !cJSON_IsNull(selected_dnn)) {
ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [selected_dnn]");
goto end;
}
}
cJSON *access_type = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "accessType");
access_type = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "accessType");
if (!access_type) {
ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [access_type]");
goto end;
}
OpenAPI_access_type_e access_typeVariable;
if (!cJSON_IsString(access_type)) {
ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [access_type]");
goto end;
}
access_typeVariable = OpenAPI_access_type_FromString(access_type->valuestring);
cJSON *additional_access_type = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "additionalAccessType");
OpenAPI_access_type_e additional_access_typeVariable;
additional_access_type = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "additionalAccessType");
if (additional_access_type) {
if (!cJSON_IsString(additional_access_type)) {
ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [additional_access_type]");
@ -368,65 +456,56 @@ OpenAPI_pdu_session_context_t *OpenAPI_pdu_session_context_parseFromJSON(cJSON *
additional_access_typeVariable = OpenAPI_access_type_FromString(additional_access_type->valuestring);
}
cJSON *allocated_ebi_list = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "allocatedEbiList");
OpenAPI_list_t *allocated_ebi_listList;
allocated_ebi_list = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "allocatedEbiList");
if (allocated_ebi_list) {
cJSON *allocated_ebi_list_local_nonprimitive;
if (!cJSON_IsArray(allocated_ebi_list)){
ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [allocated_ebi_list]");
goto end;
}
allocated_ebi_listList = OpenAPI_list_create();
cJSON_ArrayForEach(allocated_ebi_list_local_nonprimitive, allocated_ebi_list ) {
if (!cJSON_IsObject(allocated_ebi_list_local_nonprimitive)) {
cJSON *allocated_ebi_list_local = NULL;
if (!cJSON_IsArray(allocated_ebi_list)) {
ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [allocated_ebi_list]");
goto end;
}
OpenAPI_ebi_arp_mapping_t *allocated_ebi_listItem = OpenAPI_ebi_arp_mapping_parseFromJSON(allocated_ebi_list_local_nonprimitive);
if (!allocated_ebi_listItem) {
ogs_error("No allocated_ebi_listItem");
OpenAPI_list_free(allocated_ebi_listList);
goto end;
allocated_ebi_listList = OpenAPI_list_create();
cJSON_ArrayForEach(allocated_ebi_list_local, allocated_ebi_list) {
if (!cJSON_IsObject(allocated_ebi_list_local)) {
ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [allocated_ebi_list]");
goto end;
}
OpenAPI_ebi_arp_mapping_t *allocated_ebi_listItem = OpenAPI_ebi_arp_mapping_parseFromJSON(allocated_ebi_list_local);
if (!allocated_ebi_listItem) {
ogs_error("No allocated_ebi_listItem");
OpenAPI_list_free(allocated_ebi_listList);
goto end;
}
OpenAPI_list_add(allocated_ebi_listList, allocated_ebi_listItem);
}
OpenAPI_list_add(allocated_ebi_listList, allocated_ebi_listItem);
}
}
cJSON *hsmf_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "hsmfId");
hsmf_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "hsmfId");
if (hsmf_id) {
if (!cJSON_IsString(hsmf_id)) {
if (!cJSON_IsString(hsmf_id) && !cJSON_IsNull(hsmf_id)) {
ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [hsmf_id]");
goto end;
}
}
cJSON *hsmf_set_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "hsmfSetId");
hsmf_set_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "hsmfSetId");
if (hsmf_set_id) {
if (!cJSON_IsString(hsmf_set_id)) {
if (!cJSON_IsString(hsmf_set_id) && !cJSON_IsNull(hsmf_set_id)) {
ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [hsmf_set_id]");
goto end;
}
}
cJSON *hsmf_service_set_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "hsmfServiceSetId");
hsmf_service_set_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "hsmfServiceSetId");
if (hsmf_service_set_id) {
if (!cJSON_IsString(hsmf_service_set_id)) {
if (!cJSON_IsString(hsmf_service_set_id) && !cJSON_IsNull(hsmf_service_set_id)) {
ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [hsmf_service_set_id]");
goto end;
}
}
cJSON *smf_binding = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "smfBinding");
OpenAPI_sbi_binding_level_e smf_bindingVariable;
smf_binding = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "smfBinding");
if (smf_binding) {
if (!cJSON_IsString(smf_binding)) {
ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [smf_binding]");
@ -435,36 +514,31 @@ OpenAPI_pdu_session_context_t *OpenAPI_pdu_session_context_parseFromJSON(cJSON *
smf_bindingVariable = OpenAPI_sbi_binding_level_FromString(smf_binding->valuestring);
}
cJSON *vsmf_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "vsmfId");
vsmf_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "vsmfId");
if (vsmf_id) {
if (!cJSON_IsString(vsmf_id)) {
if (!cJSON_IsString(vsmf_id) && !cJSON_IsNull(vsmf_id)) {
ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [vsmf_id]");
goto end;
}
}
cJSON *vsmf_set_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "vsmfSetId");
vsmf_set_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "vsmfSetId");
if (vsmf_set_id) {
if (!cJSON_IsString(vsmf_set_id)) {
if (!cJSON_IsString(vsmf_set_id) && !cJSON_IsNull(vsmf_set_id)) {
ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [vsmf_set_id]");
goto end;
}
}
cJSON *vsmf_service_set_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "vsmfServiceSetId");
vsmf_service_set_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "vsmfServiceSetId");
if (vsmf_service_set_id) {
if (!cJSON_IsString(vsmf_service_set_id)) {
if (!cJSON_IsString(vsmf_service_set_id) && !cJSON_IsNull(vsmf_service_set_id)) {
ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [vsmf_service_set_id]");
goto end;
}
}
cJSON *vsmf_binding = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "vsmfBinding");
OpenAPI_sbi_binding_level_e vsmf_bindingVariable;
vsmf_binding = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "vsmfBinding");
if (vsmf_binding) {
if (!cJSON_IsString(vsmf_binding)) {
ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [vsmf_binding]");
@ -473,36 +547,31 @@ OpenAPI_pdu_session_context_t *OpenAPI_pdu_session_context_parseFromJSON(cJSON *
vsmf_bindingVariable = OpenAPI_sbi_binding_level_FromString(vsmf_binding->valuestring);
}
cJSON *ismf_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "ismfId");
ismf_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "ismfId");
if (ismf_id) {
if (!cJSON_IsString(ismf_id)) {
if (!cJSON_IsString(ismf_id) && !cJSON_IsNull(ismf_id)) {
ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [ismf_id]");
goto end;
}
}
cJSON *ismf_set_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "ismfSetId");
ismf_set_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "ismfSetId");
if (ismf_set_id) {
if (!cJSON_IsString(ismf_set_id)) {
if (!cJSON_IsString(ismf_set_id) && !cJSON_IsNull(ismf_set_id)) {
ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [ismf_set_id]");
goto end;
}
}
cJSON *ismf_service_set_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "ismfServiceSetId");
ismf_service_set_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "ismfServiceSetId");
if (ismf_service_set_id) {
if (!cJSON_IsString(ismf_service_set_id)) {
if (!cJSON_IsString(ismf_service_set_id) && !cJSON_IsNull(ismf_service_set_id)) {
ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [ismf_service_set_id]");
goto end;
}
}
cJSON *ismf_binding = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "ismfBinding");
OpenAPI_sbi_binding_level_e ismf_bindingVariable;
ismf_binding = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "ismfBinding");
if (ismf_binding) {
if (!cJSON_IsString(ismf_binding)) {
ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [ismf_binding]");
@ -511,26 +580,23 @@ OpenAPI_pdu_session_context_t *OpenAPI_pdu_session_context_parseFromJSON(cJSON *
ismf_bindingVariable = OpenAPI_sbi_binding_level_FromString(ismf_binding->valuestring);
}
cJSON *ns_instance = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "nsInstance");
ns_instance = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "nsInstance");
if (ns_instance) {
if (!cJSON_IsString(ns_instance)) {
if (!cJSON_IsString(ns_instance) && !cJSON_IsNull(ns_instance)) {
ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [ns_instance]");
goto end;
}
}
cJSON *smf_service_instance_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "smfServiceInstanceId");
smf_service_instance_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "smfServiceInstanceId");
if (smf_service_instance_id) {
if (!cJSON_IsString(smf_service_instance_id)) {
if (!cJSON_IsString(smf_service_instance_id) && !cJSON_IsNull(smf_service_instance_id)) {
ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [smf_service_instance_id]");
goto end;
}
}
cJSON *ma_pdu_session = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "maPduSession");
ma_pdu_session = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "maPduSession");
if (ma_pdu_session) {
if (!cJSON_IsBool(ma_pdu_session)) {
ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [ma_pdu_session]");
@ -538,9 +604,7 @@ OpenAPI_pdu_session_context_t *OpenAPI_pdu_session_context_parseFromJSON(cJSON *
}
}
cJSON *cn_assisted_ran_para = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "cnAssistedRanPara");
OpenAPI_cn_assisted_ran_para_t *cn_assisted_ran_para_local_nonprim = NULL;
cn_assisted_ran_para = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "cnAssistedRanPara");
if (cn_assisted_ran_para) {
cn_assisted_ran_para_local_nonprim = OpenAPI_cn_assisted_ran_para_parseFromJSON(cn_assisted_ran_para);
}
@ -551,24 +615,24 @@ OpenAPI_pdu_session_context_t *OpenAPI_pdu_session_context_parseFromJSON(cJSON *
ogs_strdup(sm_context_ref->valuestring),
s_nssai_local_nonprim,
ogs_strdup(dnn->valuestring),
selected_dnn ? ogs_strdup(selected_dnn->valuestring) : NULL,
selected_dnn && !cJSON_IsNull(selected_dnn) ? ogs_strdup(selected_dnn->valuestring) : NULL,
access_typeVariable,
additional_access_type ? additional_access_typeVariable : 0,
allocated_ebi_list ? allocated_ebi_listList : NULL,
hsmf_id ? ogs_strdup(hsmf_id->valuestring) : NULL,
hsmf_set_id ? ogs_strdup(hsmf_set_id->valuestring) : NULL,
hsmf_service_set_id ? ogs_strdup(hsmf_service_set_id->valuestring) : NULL,
hsmf_id && !cJSON_IsNull(hsmf_id) ? ogs_strdup(hsmf_id->valuestring) : NULL,
hsmf_set_id && !cJSON_IsNull(hsmf_set_id) ? ogs_strdup(hsmf_set_id->valuestring) : NULL,
hsmf_service_set_id && !cJSON_IsNull(hsmf_service_set_id) ? ogs_strdup(hsmf_service_set_id->valuestring) : NULL,
smf_binding ? smf_bindingVariable : 0,
vsmf_id ? ogs_strdup(vsmf_id->valuestring) : NULL,
vsmf_set_id ? ogs_strdup(vsmf_set_id->valuestring) : NULL,
vsmf_service_set_id ? ogs_strdup(vsmf_service_set_id->valuestring) : NULL,
vsmf_id && !cJSON_IsNull(vsmf_id) ? ogs_strdup(vsmf_id->valuestring) : NULL,
vsmf_set_id && !cJSON_IsNull(vsmf_set_id) ? ogs_strdup(vsmf_set_id->valuestring) : NULL,
vsmf_service_set_id && !cJSON_IsNull(vsmf_service_set_id) ? ogs_strdup(vsmf_service_set_id->valuestring) : NULL,
vsmf_binding ? vsmf_bindingVariable : 0,
ismf_id ? ogs_strdup(ismf_id->valuestring) : NULL,
ismf_set_id ? ogs_strdup(ismf_set_id->valuestring) : NULL,
ismf_service_set_id ? ogs_strdup(ismf_service_set_id->valuestring) : NULL,
ismf_id && !cJSON_IsNull(ismf_id) ? ogs_strdup(ismf_id->valuestring) : NULL,
ismf_set_id && !cJSON_IsNull(ismf_set_id) ? ogs_strdup(ismf_set_id->valuestring) : NULL,
ismf_service_set_id && !cJSON_IsNull(ismf_service_set_id) ? ogs_strdup(ismf_service_set_id->valuestring) : NULL,
ismf_binding ? ismf_bindingVariable : 0,
ns_instance ? ogs_strdup(ns_instance->valuestring) : NULL,
smf_service_instance_id ? ogs_strdup(smf_service_instance_id->valuestring) : NULL,
ns_instance && !cJSON_IsNull(ns_instance) ? ogs_strdup(ns_instance->valuestring) : NULL,
smf_service_instance_id && !cJSON_IsNull(smf_service_instance_id) ? ogs_strdup(smf_service_instance_id->valuestring) : NULL,
ma_pdu_session ? true : false,
ma_pdu_session ? ma_pdu_session->valueint : 0,
cn_assisted_ran_para ? cn_assisted_ran_para_local_nonprim : NULL
@ -576,6 +640,21 @@ OpenAPI_pdu_session_context_t *OpenAPI_pdu_session_context_parseFromJSON(cJSON *
return pdu_session_context_local_var;
end:
if (s_nssai_local_nonprim) {
OpenAPI_snssai_free(s_nssai_local_nonprim);
s_nssai_local_nonprim = NULL;
}
if (allocated_ebi_listList) {
OpenAPI_list_for_each(allocated_ebi_listList, node) {
OpenAPI_ebi_arp_mapping_free(node->data);
}
OpenAPI_list_free(allocated_ebi_listList);
allocated_ebi_listList = NULL;
}
if (cn_assisted_ran_para_local_nonprim) {
OpenAPI_cn_assisted_ran_para_free(cn_assisted_ran_para_local_nonprim);
cn_assisted_ran_para_local_nonprim = NULL;
}
return NULL;
}