mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-02 13:20:08 +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
|
|
@ -52,48 +52,101 @@ OpenAPI_subscription_data_t *OpenAPI_subscription_data_create(
|
|||
|
||||
void OpenAPI_subscription_data_free(OpenAPI_subscription_data_t *subscription_data)
|
||||
{
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (NULL == subscription_data) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(subscription_data->nf_status_notification_uri);
|
||||
ogs_free(subscription_data->req_nf_instance_id);
|
||||
OpenAPI_subscription_data_subscr_cond_free(subscription_data->subscr_cond);
|
||||
ogs_free(subscription_data->subscription_id);
|
||||
ogs_free(subscription_data->validity_time);
|
||||
OpenAPI_list_free(subscription_data->req_notif_events);
|
||||
OpenAPI_plmn_id_free(subscription_data->plmn_id);
|
||||
ogs_free(subscription_data->nid);
|
||||
OpenAPI_notif_condition_free(subscription_data->notif_condition);
|
||||
ogs_free(subscription_data->req_nf_fqdn);
|
||||
OpenAPI_list_for_each(subscription_data->req_snssais, node) {
|
||||
OpenAPI_snssai_free(node->data);
|
||||
if (subscription_data->nf_status_notification_uri) {
|
||||
ogs_free(subscription_data->nf_status_notification_uri);
|
||||
subscription_data->nf_status_notification_uri = NULL;
|
||||
}
|
||||
OpenAPI_list_free(subscription_data->req_snssais);
|
||||
OpenAPI_list_for_each(subscription_data->req_per_plmn_snssais, node) {
|
||||
OpenAPI_plmn_snssai_free(node->data);
|
||||
if (subscription_data->req_nf_instance_id) {
|
||||
ogs_free(subscription_data->req_nf_instance_id);
|
||||
subscription_data->req_nf_instance_id = NULL;
|
||||
}
|
||||
OpenAPI_list_free(subscription_data->req_per_plmn_snssais);
|
||||
OpenAPI_list_for_each(subscription_data->req_plmn_list, node) {
|
||||
OpenAPI_plmn_id_free(node->data);
|
||||
if (subscription_data->subscr_cond) {
|
||||
OpenAPI_subscription_data_subscr_cond_free(subscription_data->subscr_cond);
|
||||
subscription_data->subscr_cond = NULL;
|
||||
}
|
||||
OpenAPI_list_free(subscription_data->req_plmn_list);
|
||||
OpenAPI_list_for_each(subscription_data->req_snpn_list, node) {
|
||||
OpenAPI_plmn_id_nid_free(node->data);
|
||||
if (subscription_data->subscription_id) {
|
||||
ogs_free(subscription_data->subscription_id);
|
||||
subscription_data->subscription_id = NULL;
|
||||
}
|
||||
OpenAPI_list_free(subscription_data->req_snpn_list);
|
||||
OpenAPI_list_for_each(subscription_data->serving_scope, node) {
|
||||
ogs_free(node->data);
|
||||
if (subscription_data->validity_time) {
|
||||
ogs_free(subscription_data->validity_time);
|
||||
subscription_data->validity_time = NULL;
|
||||
}
|
||||
if (subscription_data->req_notif_events) {
|
||||
OpenAPI_list_free(subscription_data->req_notif_events);
|
||||
subscription_data->req_notif_events = NULL;
|
||||
}
|
||||
if (subscription_data->plmn_id) {
|
||||
OpenAPI_plmn_id_free(subscription_data->plmn_id);
|
||||
subscription_data->plmn_id = NULL;
|
||||
}
|
||||
if (subscription_data->nid) {
|
||||
ogs_free(subscription_data->nid);
|
||||
subscription_data->nid = NULL;
|
||||
}
|
||||
if (subscription_data->notif_condition) {
|
||||
OpenAPI_notif_condition_free(subscription_data->notif_condition);
|
||||
subscription_data->notif_condition = NULL;
|
||||
}
|
||||
if (subscription_data->req_nf_fqdn) {
|
||||
ogs_free(subscription_data->req_nf_fqdn);
|
||||
subscription_data->req_nf_fqdn = NULL;
|
||||
}
|
||||
if (subscription_data->req_snssais) {
|
||||
OpenAPI_list_for_each(subscription_data->req_snssais, node) {
|
||||
OpenAPI_snssai_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(subscription_data->req_snssais);
|
||||
subscription_data->req_snssais = NULL;
|
||||
}
|
||||
if (subscription_data->req_per_plmn_snssais) {
|
||||
OpenAPI_list_for_each(subscription_data->req_per_plmn_snssais, node) {
|
||||
OpenAPI_plmn_snssai_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(subscription_data->req_per_plmn_snssais);
|
||||
subscription_data->req_per_plmn_snssais = NULL;
|
||||
}
|
||||
if (subscription_data->req_plmn_list) {
|
||||
OpenAPI_list_for_each(subscription_data->req_plmn_list, node) {
|
||||
OpenAPI_plmn_id_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(subscription_data->req_plmn_list);
|
||||
subscription_data->req_plmn_list = NULL;
|
||||
}
|
||||
if (subscription_data->req_snpn_list) {
|
||||
OpenAPI_list_for_each(subscription_data->req_snpn_list, node) {
|
||||
OpenAPI_plmn_id_nid_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(subscription_data->req_snpn_list);
|
||||
subscription_data->req_snpn_list = NULL;
|
||||
}
|
||||
if (subscription_data->serving_scope) {
|
||||
OpenAPI_list_for_each(subscription_data->serving_scope, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(subscription_data->serving_scope);
|
||||
subscription_data->serving_scope = NULL;
|
||||
}
|
||||
if (subscription_data->requester_features) {
|
||||
ogs_free(subscription_data->requester_features);
|
||||
subscription_data->requester_features = NULL;
|
||||
}
|
||||
if (subscription_data->nrf_supported_features) {
|
||||
ogs_free(subscription_data->nrf_supported_features);
|
||||
subscription_data->nrf_supported_features = NULL;
|
||||
}
|
||||
OpenAPI_list_free(subscription_data->serving_scope);
|
||||
ogs_free(subscription_data->requester_features);
|
||||
ogs_free(subscription_data->nrf_supported_features);
|
||||
ogs_free(subscription_data);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_subscription_data_convertToJSON(OpenAPI_subscription_data_t *subscription_data)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (subscription_data == NULL) {
|
||||
ogs_error("OpenAPI_subscription_data_convertToJSON() failed [SubscriptionData]");
|
||||
|
|
@ -101,6 +154,10 @@ cJSON *OpenAPI_subscription_data_convertToJSON(OpenAPI_subscription_data_t *subs
|
|||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (!subscription_data->nf_status_notification_uri) {
|
||||
ogs_error("OpenAPI_subscription_data_convertToJSON() failed [nf_status_notification_uri]");
|
||||
return NULL;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "nfStatusNotificationUri", subscription_data->nf_status_notification_uri) == NULL) {
|
||||
ogs_error("OpenAPI_subscription_data_convertToJSON() failed [nf_status_notification_uri]");
|
||||
goto end;
|
||||
|
|
@ -140,15 +197,14 @@ cJSON *OpenAPI_subscription_data_convertToJSON(OpenAPI_subscription_data_t *subs
|
|||
}
|
||||
}
|
||||
|
||||
if (subscription_data->req_notif_events) {
|
||||
cJSON *req_notif_events = cJSON_AddArrayToObject(item, "reqNotifEvents");
|
||||
if (req_notif_events == NULL) {
|
||||
if (subscription_data->req_notif_events != OpenAPI_notification_event_type_NULL) {
|
||||
cJSON *req_notif_eventsList = cJSON_AddArrayToObject(item, "reqNotifEvents");
|
||||
if (req_notif_eventsList == NULL) {
|
||||
ogs_error("OpenAPI_subscription_data_convertToJSON() failed [req_notif_events]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_lnode_t *req_notif_events_node;
|
||||
OpenAPI_list_for_each(subscription_data->req_notif_events, req_notif_events_node) {
|
||||
if (cJSON_AddStringToObject(req_notif_events, "", OpenAPI_notification_event_type_ToString((intptr_t)req_notif_events_node->data)) == NULL) {
|
||||
OpenAPI_list_for_each(subscription_data->req_notif_events, node) {
|
||||
if (cJSON_AddStringToObject(req_notif_eventsList, "", OpenAPI_notification_event_type_ToString((intptr_t)node->data)) == NULL) {
|
||||
ogs_error("OpenAPI_subscription_data_convertToJSON() failed [req_notif_events]");
|
||||
goto end;
|
||||
}
|
||||
|
|
@ -188,7 +244,7 @@ cJSON *OpenAPI_subscription_data_convertToJSON(OpenAPI_subscription_data_t *subs
|
|||
}
|
||||
}
|
||||
|
||||
if (subscription_data->req_nf_type) {
|
||||
if (subscription_data->req_nf_type != OpenAPI_nf_type_NULL) {
|
||||
if (cJSON_AddStringToObject(item, "reqNfType", OpenAPI_nf_type_ToString(subscription_data->req_nf_type)) == NULL) {
|
||||
ogs_error("OpenAPI_subscription_data_convertToJSON() failed [req_nf_type]");
|
||||
goto end;
|
||||
|
|
@ -208,17 +264,13 @@ cJSON *OpenAPI_subscription_data_convertToJSON(OpenAPI_subscription_data_t *subs
|
|||
ogs_error("OpenAPI_subscription_data_convertToJSON() failed [req_snssais]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *req_snssais_node;
|
||||
if (subscription_data->req_snssais) {
|
||||
OpenAPI_list_for_each(subscription_data->req_snssais, req_snssais_node) {
|
||||
cJSON *itemLocal = OpenAPI_snssai_convertToJSON(req_snssais_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_subscription_data_convertToJSON() failed [req_snssais]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(req_snssaisList, itemLocal);
|
||||
OpenAPI_list_for_each(subscription_data->req_snssais, node) {
|
||||
cJSON *itemLocal = OpenAPI_snssai_convertToJSON(node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_subscription_data_convertToJSON() failed [req_snssais]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(req_snssaisList, itemLocal);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -228,17 +280,13 @@ cJSON *OpenAPI_subscription_data_convertToJSON(OpenAPI_subscription_data_t *subs
|
|||
ogs_error("OpenAPI_subscription_data_convertToJSON() failed [req_per_plmn_snssais]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *req_per_plmn_snssais_node;
|
||||
if (subscription_data->req_per_plmn_snssais) {
|
||||
OpenAPI_list_for_each(subscription_data->req_per_plmn_snssais, req_per_plmn_snssais_node) {
|
||||
cJSON *itemLocal = OpenAPI_plmn_snssai_convertToJSON(req_per_plmn_snssais_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_subscription_data_convertToJSON() failed [req_per_plmn_snssais]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(req_per_plmn_snssaisList, itemLocal);
|
||||
OpenAPI_list_for_each(subscription_data->req_per_plmn_snssais, node) {
|
||||
cJSON *itemLocal = OpenAPI_plmn_snssai_convertToJSON(node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_subscription_data_convertToJSON() failed [req_per_plmn_snssais]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(req_per_plmn_snssaisList, itemLocal);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -248,17 +296,13 @@ cJSON *OpenAPI_subscription_data_convertToJSON(OpenAPI_subscription_data_t *subs
|
|||
ogs_error("OpenAPI_subscription_data_convertToJSON() failed [req_plmn_list]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *req_plmn_list_node;
|
||||
if (subscription_data->req_plmn_list) {
|
||||
OpenAPI_list_for_each(subscription_data->req_plmn_list, req_plmn_list_node) {
|
||||
cJSON *itemLocal = OpenAPI_plmn_id_convertToJSON(req_plmn_list_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_subscription_data_convertToJSON() failed [req_plmn_list]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(req_plmn_listList, itemLocal);
|
||||
OpenAPI_list_for_each(subscription_data->req_plmn_list, node) {
|
||||
cJSON *itemLocal = OpenAPI_plmn_id_convertToJSON(node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_subscription_data_convertToJSON() failed [req_plmn_list]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(req_plmn_listList, itemLocal);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -268,34 +312,28 @@ cJSON *OpenAPI_subscription_data_convertToJSON(OpenAPI_subscription_data_t *subs
|
|||
ogs_error("OpenAPI_subscription_data_convertToJSON() failed [req_snpn_list]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *req_snpn_list_node;
|
||||
if (subscription_data->req_snpn_list) {
|
||||
OpenAPI_list_for_each(subscription_data->req_snpn_list, req_snpn_list_node) {
|
||||
cJSON *itemLocal = OpenAPI_plmn_id_nid_convertToJSON(req_snpn_list_node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_subscription_data_convertToJSON() failed [req_snpn_list]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(req_snpn_listList, itemLocal);
|
||||
OpenAPI_list_for_each(subscription_data->req_snpn_list, node) {
|
||||
cJSON *itemLocal = OpenAPI_plmn_id_nid_convertToJSON(node->data);
|
||||
if (itemLocal == NULL) {
|
||||
ogs_error("OpenAPI_subscription_data_convertToJSON() failed [req_snpn_list]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToArray(req_snpn_listList, itemLocal);
|
||||
}
|
||||
}
|
||||
|
||||
if (subscription_data->serving_scope) {
|
||||
cJSON *serving_scope = cJSON_AddArrayToObject(item, "servingScope");
|
||||
if (serving_scope == NULL) {
|
||||
cJSON *serving_scopeList = cJSON_AddArrayToObject(item, "servingScope");
|
||||
if (serving_scopeList == NULL) {
|
||||
ogs_error("OpenAPI_subscription_data_convertToJSON() failed [serving_scope]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *serving_scope_node;
|
||||
OpenAPI_list_for_each(subscription_data->serving_scope, serving_scope_node) {
|
||||
if (cJSON_AddStringToObject(serving_scope, "", (char*)serving_scope_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_subscription_data_convertToJSON() failed [serving_scope]");
|
||||
goto end;
|
||||
OpenAPI_list_for_each(subscription_data->serving_scope, node) {
|
||||
if (cJSON_AddStringToObject(serving_scopeList, "", (char*)node->data) == NULL) {
|
||||
ogs_error("OpenAPI_subscription_data_convertToJSON() failed [serving_scope]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (subscription_data->requester_features) {
|
||||
|
|
@ -319,99 +357,112 @@ end:
|
|||
OpenAPI_subscription_data_t *OpenAPI_subscription_data_parseFromJSON(cJSON *subscription_dataJSON)
|
||||
{
|
||||
OpenAPI_subscription_data_t *subscription_data_local_var = NULL;
|
||||
cJSON *nf_status_notification_uri = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "nfStatusNotificationUri");
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *nf_status_notification_uri = NULL;
|
||||
cJSON *req_nf_instance_id = NULL;
|
||||
cJSON *subscr_cond = NULL;
|
||||
OpenAPI_subscription_data_subscr_cond_t *subscr_cond_local_nonprim = NULL;
|
||||
cJSON *subscription_id = NULL;
|
||||
cJSON *validity_time = NULL;
|
||||
cJSON *req_notif_events = NULL;
|
||||
OpenAPI_list_t *req_notif_eventsList = NULL;
|
||||
cJSON *plmn_id = NULL;
|
||||
OpenAPI_plmn_id_t *plmn_id_local_nonprim = NULL;
|
||||
cJSON *nid = NULL;
|
||||
cJSON *notif_condition = NULL;
|
||||
OpenAPI_notif_condition_t *notif_condition_local_nonprim = NULL;
|
||||
cJSON *req_nf_type = NULL;
|
||||
OpenAPI_nf_type_e req_nf_typeVariable = 0;
|
||||
cJSON *req_nf_fqdn = NULL;
|
||||
cJSON *req_snssais = NULL;
|
||||
OpenAPI_list_t *req_snssaisList = NULL;
|
||||
cJSON *req_per_plmn_snssais = NULL;
|
||||
OpenAPI_list_t *req_per_plmn_snssaisList = NULL;
|
||||
cJSON *req_plmn_list = NULL;
|
||||
OpenAPI_list_t *req_plmn_listList = NULL;
|
||||
cJSON *req_snpn_list = NULL;
|
||||
OpenAPI_list_t *req_snpn_listList = NULL;
|
||||
cJSON *serving_scope = NULL;
|
||||
OpenAPI_list_t *serving_scopeList = NULL;
|
||||
cJSON *requester_features = NULL;
|
||||
cJSON *nrf_supported_features = NULL;
|
||||
nf_status_notification_uri = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "nfStatusNotificationUri");
|
||||
if (!nf_status_notification_uri) {
|
||||
ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [nf_status_notification_uri]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!cJSON_IsString(nf_status_notification_uri)) {
|
||||
ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [nf_status_notification_uri]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON *req_nf_instance_id = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "reqNfInstanceId");
|
||||
|
||||
req_nf_instance_id = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "reqNfInstanceId");
|
||||
if (req_nf_instance_id) {
|
||||
if (!cJSON_IsString(req_nf_instance_id)) {
|
||||
if (!cJSON_IsString(req_nf_instance_id) && !cJSON_IsNull(req_nf_instance_id)) {
|
||||
ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [req_nf_instance_id]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *subscr_cond = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "subscrCond");
|
||||
|
||||
OpenAPI_subscription_data_subscr_cond_t *subscr_cond_local_nonprim = NULL;
|
||||
subscr_cond = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "subscrCond");
|
||||
if (subscr_cond) {
|
||||
subscr_cond_local_nonprim = OpenAPI_subscription_data_subscr_cond_parseFromJSON(subscr_cond);
|
||||
}
|
||||
|
||||
cJSON *subscription_id = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "subscriptionId");
|
||||
|
||||
subscription_id = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "subscriptionId");
|
||||
if (subscription_id) {
|
||||
if (!cJSON_IsString(subscription_id)) {
|
||||
if (!cJSON_IsString(subscription_id) && !cJSON_IsNull(subscription_id)) {
|
||||
ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [subscription_id]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *validity_time = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "validityTime");
|
||||
|
||||
validity_time = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "validityTime");
|
||||
if (validity_time) {
|
||||
if (!cJSON_IsString(validity_time)) {
|
||||
if (!cJSON_IsString(validity_time) && !cJSON_IsNull(validity_time)) {
|
||||
ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [validity_time]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *req_notif_events = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "reqNotifEvents");
|
||||
|
||||
OpenAPI_list_t *req_notif_eventsList;
|
||||
req_notif_events = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "reqNotifEvents");
|
||||
if (req_notif_events) {
|
||||
cJSON *req_notif_events_local_nonprimitive;
|
||||
if (!cJSON_IsArray(req_notif_events)) {
|
||||
ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [req_notif_events]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
req_notif_eventsList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(req_notif_events_local_nonprimitive, req_notif_events ) {
|
||||
if (!cJSON_IsString(req_notif_events_local_nonprimitive)){
|
||||
cJSON *req_notif_events_local = NULL;
|
||||
if (!cJSON_IsArray(req_notif_events)) {
|
||||
ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [req_notif_events]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_list_add(req_notif_eventsList, (void *)OpenAPI_notification_event_type_FromString(req_notif_events_local_nonprimitive->valuestring));
|
||||
}
|
||||
req_notif_eventsList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(req_notif_events_local, req_notif_events) {
|
||||
if (!cJSON_IsString(req_notif_events_local)) {
|
||||
ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [req_notif_events]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(req_notif_eventsList, (void *)OpenAPI_notification_event_type_FromString(req_notif_events_local->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *plmn_id = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "plmnId");
|
||||
|
||||
OpenAPI_plmn_id_t *plmn_id_local_nonprim = NULL;
|
||||
plmn_id = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "plmnId");
|
||||
if (plmn_id) {
|
||||
plmn_id_local_nonprim = OpenAPI_plmn_id_parseFromJSON(plmn_id);
|
||||
}
|
||||
|
||||
cJSON *nid = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "nid");
|
||||
|
||||
nid = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "nid");
|
||||
if (nid) {
|
||||
if (!cJSON_IsString(nid)) {
|
||||
if (!cJSON_IsString(nid) && !cJSON_IsNull(nid)) {
|
||||
ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [nid]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *notif_condition = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "notifCondition");
|
||||
|
||||
OpenAPI_notif_condition_t *notif_condition_local_nonprim = NULL;
|
||||
notif_condition = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "notifCondition");
|
||||
if (notif_condition) {
|
||||
notif_condition_local_nonprim = OpenAPI_notif_condition_parseFromJSON(notif_condition);
|
||||
}
|
||||
|
||||
cJSON *req_nf_type = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "reqNfType");
|
||||
|
||||
OpenAPI_nf_type_e req_nf_typeVariable;
|
||||
req_nf_type = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "reqNfType");
|
||||
if (req_nf_type) {
|
||||
if (!cJSON_IsString(req_nf_type)) {
|
||||
ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [req_nf_type]");
|
||||
|
|
@ -420,164 +471,146 @@ OpenAPI_subscription_data_t *OpenAPI_subscription_data_parseFromJSON(cJSON *subs
|
|||
req_nf_typeVariable = OpenAPI_nf_type_FromString(req_nf_type->valuestring);
|
||||
}
|
||||
|
||||
cJSON *req_nf_fqdn = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "reqNfFqdn");
|
||||
|
||||
req_nf_fqdn = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "reqNfFqdn");
|
||||
if (req_nf_fqdn) {
|
||||
if (!cJSON_IsString(req_nf_fqdn)) {
|
||||
if (!cJSON_IsString(req_nf_fqdn) && !cJSON_IsNull(req_nf_fqdn)) {
|
||||
ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [req_nf_fqdn]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *req_snssais = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "reqSnssais");
|
||||
|
||||
OpenAPI_list_t *req_snssaisList;
|
||||
req_snssais = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "reqSnssais");
|
||||
if (req_snssais) {
|
||||
cJSON *req_snssais_local_nonprimitive;
|
||||
if (!cJSON_IsArray(req_snssais)){
|
||||
ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [req_snssais]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
req_snssaisList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(req_snssais_local_nonprimitive, req_snssais ) {
|
||||
if (!cJSON_IsObject(req_snssais_local_nonprimitive)) {
|
||||
cJSON *req_snssais_local = NULL;
|
||||
if (!cJSON_IsArray(req_snssais)) {
|
||||
ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [req_snssais]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_snssai_t *req_snssaisItem = OpenAPI_snssai_parseFromJSON(req_snssais_local_nonprimitive);
|
||||
|
||||
if (!req_snssaisItem) {
|
||||
ogs_error("No req_snssaisItem");
|
||||
OpenAPI_list_free(req_snssaisList);
|
||||
goto end;
|
||||
req_snssaisList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(req_snssais_local, req_snssais) {
|
||||
if (!cJSON_IsObject(req_snssais_local)) {
|
||||
ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [req_snssais]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_snssai_t *req_snssaisItem = OpenAPI_snssai_parseFromJSON(req_snssais_local);
|
||||
if (!req_snssaisItem) {
|
||||
ogs_error("No req_snssaisItem");
|
||||
OpenAPI_list_free(req_snssaisList);
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(req_snssaisList, req_snssaisItem);
|
||||
}
|
||||
|
||||
OpenAPI_list_add(req_snssaisList, req_snssaisItem);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *req_per_plmn_snssais = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "reqPerPlmnSnssais");
|
||||
|
||||
OpenAPI_list_t *req_per_plmn_snssaisList;
|
||||
req_per_plmn_snssais = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "reqPerPlmnSnssais");
|
||||
if (req_per_plmn_snssais) {
|
||||
cJSON *req_per_plmn_snssais_local_nonprimitive;
|
||||
if (!cJSON_IsArray(req_per_plmn_snssais)){
|
||||
ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [req_per_plmn_snssais]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
req_per_plmn_snssaisList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(req_per_plmn_snssais_local_nonprimitive, req_per_plmn_snssais ) {
|
||||
if (!cJSON_IsObject(req_per_plmn_snssais_local_nonprimitive)) {
|
||||
cJSON *req_per_plmn_snssais_local = NULL;
|
||||
if (!cJSON_IsArray(req_per_plmn_snssais)) {
|
||||
ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [req_per_plmn_snssais]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_plmn_snssai_t *req_per_plmn_snssaisItem = OpenAPI_plmn_snssai_parseFromJSON(req_per_plmn_snssais_local_nonprimitive);
|
||||
|
||||
if (!req_per_plmn_snssaisItem) {
|
||||
ogs_error("No req_per_plmn_snssaisItem");
|
||||
OpenAPI_list_free(req_per_plmn_snssaisList);
|
||||
goto end;
|
||||
req_per_plmn_snssaisList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(req_per_plmn_snssais_local, req_per_plmn_snssais) {
|
||||
if (!cJSON_IsObject(req_per_plmn_snssais_local)) {
|
||||
ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [req_per_plmn_snssais]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_plmn_snssai_t *req_per_plmn_snssaisItem = OpenAPI_plmn_snssai_parseFromJSON(req_per_plmn_snssais_local);
|
||||
if (!req_per_plmn_snssaisItem) {
|
||||
ogs_error("No req_per_plmn_snssaisItem");
|
||||
OpenAPI_list_free(req_per_plmn_snssaisList);
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(req_per_plmn_snssaisList, req_per_plmn_snssaisItem);
|
||||
}
|
||||
|
||||
OpenAPI_list_add(req_per_plmn_snssaisList, req_per_plmn_snssaisItem);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *req_plmn_list = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "reqPlmnList");
|
||||
|
||||
OpenAPI_list_t *req_plmn_listList;
|
||||
req_plmn_list = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "reqPlmnList");
|
||||
if (req_plmn_list) {
|
||||
cJSON *req_plmn_list_local_nonprimitive;
|
||||
if (!cJSON_IsArray(req_plmn_list)){
|
||||
ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [req_plmn_list]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
req_plmn_listList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(req_plmn_list_local_nonprimitive, req_plmn_list ) {
|
||||
if (!cJSON_IsObject(req_plmn_list_local_nonprimitive)) {
|
||||
cJSON *req_plmn_list_local = NULL;
|
||||
if (!cJSON_IsArray(req_plmn_list)) {
|
||||
ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [req_plmn_list]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_plmn_id_t *req_plmn_listItem = OpenAPI_plmn_id_parseFromJSON(req_plmn_list_local_nonprimitive);
|
||||
|
||||
if (!req_plmn_listItem) {
|
||||
ogs_error("No req_plmn_listItem");
|
||||
OpenAPI_list_free(req_plmn_listList);
|
||||
goto end;
|
||||
req_plmn_listList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(req_plmn_list_local, req_plmn_list) {
|
||||
if (!cJSON_IsObject(req_plmn_list_local)) {
|
||||
ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [req_plmn_list]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_plmn_id_t *req_plmn_listItem = OpenAPI_plmn_id_parseFromJSON(req_plmn_list_local);
|
||||
if (!req_plmn_listItem) {
|
||||
ogs_error("No req_plmn_listItem");
|
||||
OpenAPI_list_free(req_plmn_listList);
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(req_plmn_listList, req_plmn_listItem);
|
||||
}
|
||||
|
||||
OpenAPI_list_add(req_plmn_listList, req_plmn_listItem);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *req_snpn_list = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "reqSnpnList");
|
||||
|
||||
OpenAPI_list_t *req_snpn_listList;
|
||||
req_snpn_list = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "reqSnpnList");
|
||||
if (req_snpn_list) {
|
||||
cJSON *req_snpn_list_local_nonprimitive;
|
||||
if (!cJSON_IsArray(req_snpn_list)){
|
||||
ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [req_snpn_list]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
req_snpn_listList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(req_snpn_list_local_nonprimitive, req_snpn_list ) {
|
||||
if (!cJSON_IsObject(req_snpn_list_local_nonprimitive)) {
|
||||
cJSON *req_snpn_list_local = NULL;
|
||||
if (!cJSON_IsArray(req_snpn_list)) {
|
||||
ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [req_snpn_list]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_plmn_id_nid_t *req_snpn_listItem = OpenAPI_plmn_id_nid_parseFromJSON(req_snpn_list_local_nonprimitive);
|
||||
|
||||
if (!req_snpn_listItem) {
|
||||
ogs_error("No req_snpn_listItem");
|
||||
OpenAPI_list_free(req_snpn_listList);
|
||||
req_snpn_listList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(req_snpn_list_local, req_snpn_list) {
|
||||
if (!cJSON_IsObject(req_snpn_list_local)) {
|
||||
ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [req_snpn_list]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_plmn_id_nid_t *req_snpn_listItem = OpenAPI_plmn_id_nid_parseFromJSON(req_snpn_list_local);
|
||||
if (!req_snpn_listItem) {
|
||||
ogs_error("No req_snpn_listItem");
|
||||
OpenAPI_list_free(req_snpn_listList);
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(req_snpn_listList, req_snpn_listItem);
|
||||
}
|
||||
}
|
||||
|
||||
serving_scope = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "servingScope");
|
||||
if (serving_scope) {
|
||||
cJSON *serving_scope_local = NULL;
|
||||
if (!cJSON_IsArray(serving_scope)) {
|
||||
ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [serving_scope]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_list_add(req_snpn_listList, req_snpn_listItem);
|
||||
}
|
||||
serving_scopeList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(serving_scope_local, serving_scope) {
|
||||
double *localDouble = NULL;
|
||||
int *localInt = NULL;
|
||||
if (!cJSON_IsString(serving_scope_local)) {
|
||||
ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [serving_scope]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(serving_scopeList, ogs_strdup(serving_scope_local->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *serving_scope = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "servingScope");
|
||||
|
||||
OpenAPI_list_t *serving_scopeList;
|
||||
if (serving_scope) {
|
||||
cJSON *serving_scope_local;
|
||||
if (!cJSON_IsArray(serving_scope)) {
|
||||
ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [serving_scope]");
|
||||
goto end;
|
||||
}
|
||||
serving_scopeList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(serving_scope_local, serving_scope) {
|
||||
if (!cJSON_IsString(serving_scope_local)) {
|
||||
ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [serving_scope]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(serving_scopeList, ogs_strdup(serving_scope_local->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *requester_features = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "requesterFeatures");
|
||||
|
||||
requester_features = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "requesterFeatures");
|
||||
if (requester_features) {
|
||||
if (!cJSON_IsString(requester_features)) {
|
||||
if (!cJSON_IsString(requester_features) && !cJSON_IsNull(requester_features)) {
|
||||
ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [requester_features]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *nrf_supported_features = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "nrfSupportedFeatures");
|
||||
|
||||
nrf_supported_features = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "nrfSupportedFeatures");
|
||||
if (nrf_supported_features) {
|
||||
if (!cJSON_IsString(nrf_supported_features)) {
|
||||
if (!cJSON_IsString(nrf_supported_features) && !cJSON_IsNull(nrf_supported_features)) {
|
||||
ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [nrf_supported_features]");
|
||||
goto end;
|
||||
}
|
||||
|
|
@ -585,27 +618,78 @@ OpenAPI_subscription_data_t *OpenAPI_subscription_data_parseFromJSON(cJSON *subs
|
|||
|
||||
subscription_data_local_var = OpenAPI_subscription_data_create (
|
||||
ogs_strdup(nf_status_notification_uri->valuestring),
|
||||
req_nf_instance_id ? ogs_strdup(req_nf_instance_id->valuestring) : NULL,
|
||||
req_nf_instance_id && !cJSON_IsNull(req_nf_instance_id) ? ogs_strdup(req_nf_instance_id->valuestring) : NULL,
|
||||
subscr_cond ? subscr_cond_local_nonprim : NULL,
|
||||
subscription_id ? ogs_strdup(subscription_id->valuestring) : NULL,
|
||||
validity_time ? ogs_strdup(validity_time->valuestring) : NULL,
|
||||
subscription_id && !cJSON_IsNull(subscription_id) ? ogs_strdup(subscription_id->valuestring) : NULL,
|
||||
validity_time && !cJSON_IsNull(validity_time) ? ogs_strdup(validity_time->valuestring) : NULL,
|
||||
req_notif_events ? req_notif_eventsList : NULL,
|
||||
plmn_id ? plmn_id_local_nonprim : NULL,
|
||||
nid ? ogs_strdup(nid->valuestring) : NULL,
|
||||
nid && !cJSON_IsNull(nid) ? ogs_strdup(nid->valuestring) : NULL,
|
||||
notif_condition ? notif_condition_local_nonprim : NULL,
|
||||
req_nf_type ? req_nf_typeVariable : 0,
|
||||
req_nf_fqdn ? ogs_strdup(req_nf_fqdn->valuestring) : NULL,
|
||||
req_nf_fqdn && !cJSON_IsNull(req_nf_fqdn) ? ogs_strdup(req_nf_fqdn->valuestring) : NULL,
|
||||
req_snssais ? req_snssaisList : NULL,
|
||||
req_per_plmn_snssais ? req_per_plmn_snssaisList : NULL,
|
||||
req_plmn_list ? req_plmn_listList : NULL,
|
||||
req_snpn_list ? req_snpn_listList : NULL,
|
||||
serving_scope ? serving_scopeList : NULL,
|
||||
requester_features ? ogs_strdup(requester_features->valuestring) : NULL,
|
||||
nrf_supported_features ? ogs_strdup(nrf_supported_features->valuestring) : NULL
|
||||
requester_features && !cJSON_IsNull(requester_features) ? ogs_strdup(requester_features->valuestring) : NULL,
|
||||
nrf_supported_features && !cJSON_IsNull(nrf_supported_features) ? ogs_strdup(nrf_supported_features->valuestring) : NULL
|
||||
);
|
||||
|
||||
return subscription_data_local_var;
|
||||
end:
|
||||
if (subscr_cond_local_nonprim) {
|
||||
OpenAPI_subscription_data_subscr_cond_free(subscr_cond_local_nonprim);
|
||||
subscr_cond_local_nonprim = NULL;
|
||||
}
|
||||
if (req_notif_eventsList) {
|
||||
OpenAPI_list_free(req_notif_eventsList);
|
||||
req_notif_eventsList = NULL;
|
||||
}
|
||||
if (plmn_id_local_nonprim) {
|
||||
OpenAPI_plmn_id_free(plmn_id_local_nonprim);
|
||||
plmn_id_local_nonprim = NULL;
|
||||
}
|
||||
if (notif_condition_local_nonprim) {
|
||||
OpenAPI_notif_condition_free(notif_condition_local_nonprim);
|
||||
notif_condition_local_nonprim = NULL;
|
||||
}
|
||||
if (req_snssaisList) {
|
||||
OpenAPI_list_for_each(req_snssaisList, node) {
|
||||
OpenAPI_snssai_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(req_snssaisList);
|
||||
req_snssaisList = NULL;
|
||||
}
|
||||
if (req_per_plmn_snssaisList) {
|
||||
OpenAPI_list_for_each(req_per_plmn_snssaisList, node) {
|
||||
OpenAPI_plmn_snssai_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(req_per_plmn_snssaisList);
|
||||
req_per_plmn_snssaisList = NULL;
|
||||
}
|
||||
if (req_plmn_listList) {
|
||||
OpenAPI_list_for_each(req_plmn_listList, node) {
|
||||
OpenAPI_plmn_id_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(req_plmn_listList);
|
||||
req_plmn_listList = NULL;
|
||||
}
|
||||
if (req_snpn_listList) {
|
||||
OpenAPI_list_for_each(req_snpn_listList, node) {
|
||||
OpenAPI_plmn_id_nid_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(req_snpn_listList);
|
||||
req_snpn_listList = NULL;
|
||||
}
|
||||
if (serving_scopeList) {
|
||||
OpenAPI_list_for_each(serving_scopeList, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(serving_scopeList);
|
||||
serving_scopeList = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue