mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-04 14:20: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
|
|
@ -28,22 +28,33 @@ OpenAPI_default_notification_subscription_t *OpenAPI_default_notification_subscr
|
|||
|
||||
void OpenAPI_default_notification_subscription_free(OpenAPI_default_notification_subscription_t *default_notification_subscription)
|
||||
{
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (NULL == default_notification_subscription) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(default_notification_subscription->callback_uri);
|
||||
OpenAPI_list_for_each(default_notification_subscription->versions, node) {
|
||||
ogs_free(node->data);
|
||||
if (default_notification_subscription->callback_uri) {
|
||||
ogs_free(default_notification_subscription->callback_uri);
|
||||
default_notification_subscription->callback_uri = NULL;
|
||||
}
|
||||
if (default_notification_subscription->versions) {
|
||||
OpenAPI_list_for_each(default_notification_subscription->versions, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(default_notification_subscription->versions);
|
||||
default_notification_subscription->versions = NULL;
|
||||
}
|
||||
if (default_notification_subscription->binding) {
|
||||
ogs_free(default_notification_subscription->binding);
|
||||
default_notification_subscription->binding = NULL;
|
||||
}
|
||||
OpenAPI_list_free(default_notification_subscription->versions);
|
||||
ogs_free(default_notification_subscription->binding);
|
||||
ogs_free(default_notification_subscription);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_default_notification_subscription_convertToJSON(OpenAPI_default_notification_subscription_t *default_notification_subscription)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (default_notification_subscription == NULL) {
|
||||
ogs_error("OpenAPI_default_notification_subscription_convertToJSON() failed [DefaultNotificationSubscription]");
|
||||
|
|
@ -51,24 +62,32 @@ cJSON *OpenAPI_default_notification_subscription_convertToJSON(OpenAPI_default_n
|
|||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
if (default_notification_subscription->notification_type == OpenAPI_notification_type_NULL) {
|
||||
ogs_error("OpenAPI_default_notification_subscription_convertToJSON() failed [notification_type]");
|
||||
return NULL;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "notificationType", OpenAPI_notification_type_ToString(default_notification_subscription->notification_type)) == NULL) {
|
||||
ogs_error("OpenAPI_default_notification_subscription_convertToJSON() failed [notification_type]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!default_notification_subscription->callback_uri) {
|
||||
ogs_error("OpenAPI_default_notification_subscription_convertToJSON() failed [callback_uri]");
|
||||
return NULL;
|
||||
}
|
||||
if (cJSON_AddStringToObject(item, "callbackUri", default_notification_subscription->callback_uri) == NULL) {
|
||||
ogs_error("OpenAPI_default_notification_subscription_convertToJSON() failed [callback_uri]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (default_notification_subscription->n1_message_class) {
|
||||
if (default_notification_subscription->n1_message_class != OpenAPI_n1_message_class_NULL) {
|
||||
if (cJSON_AddStringToObject(item, "n1MessageClass", OpenAPI_n1_message_class_ToString(default_notification_subscription->n1_message_class)) == NULL) {
|
||||
ogs_error("OpenAPI_default_notification_subscription_convertToJSON() failed [n1_message_class]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (default_notification_subscription->n2_information_class) {
|
||||
if (default_notification_subscription->n2_information_class != OpenAPI_n2_information_class_NULL) {
|
||||
if (cJSON_AddStringToObject(item, "n2InformationClass", OpenAPI_n2_information_class_ToString(default_notification_subscription->n2_information_class)) == NULL) {
|
||||
ogs_error("OpenAPI_default_notification_subscription_convertToJSON() failed [n2_information_class]");
|
||||
goto end;
|
||||
|
|
@ -76,19 +95,17 @@ cJSON *OpenAPI_default_notification_subscription_convertToJSON(OpenAPI_default_n
|
|||
}
|
||||
|
||||
if (default_notification_subscription->versions) {
|
||||
cJSON *versions = cJSON_AddArrayToObject(item, "versions");
|
||||
if (versions == NULL) {
|
||||
cJSON *versionsList = cJSON_AddArrayToObject(item, "versions");
|
||||
if (versionsList == NULL) {
|
||||
ogs_error("OpenAPI_default_notification_subscription_convertToJSON() failed [versions]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *versions_node;
|
||||
OpenAPI_list_for_each(default_notification_subscription->versions, versions_node) {
|
||||
if (cJSON_AddStringToObject(versions, "", (char*)versions_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_default_notification_subscription_convertToJSON() failed [versions]");
|
||||
goto end;
|
||||
OpenAPI_list_for_each(default_notification_subscription->versions, node) {
|
||||
if (cJSON_AddStringToObject(versionsList, "", (char*)node->data) == NULL) {
|
||||
ogs_error("OpenAPI_default_notification_subscription_convertToJSON() failed [versions]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (default_notification_subscription->binding) {
|
||||
|
|
@ -105,33 +122,39 @@ end:
|
|||
OpenAPI_default_notification_subscription_t *OpenAPI_default_notification_subscription_parseFromJSON(cJSON *default_notification_subscriptionJSON)
|
||||
{
|
||||
OpenAPI_default_notification_subscription_t *default_notification_subscription_local_var = NULL;
|
||||
cJSON *notification_type = cJSON_GetObjectItemCaseSensitive(default_notification_subscriptionJSON, "notificationType");
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *notification_type = NULL;
|
||||
OpenAPI_notification_type_e notification_typeVariable = 0;
|
||||
cJSON *callback_uri = NULL;
|
||||
cJSON *n1_message_class = NULL;
|
||||
OpenAPI_n1_message_class_e n1_message_classVariable = 0;
|
||||
cJSON *n2_information_class = NULL;
|
||||
OpenAPI_n2_information_class_e n2_information_classVariable = 0;
|
||||
cJSON *versions = NULL;
|
||||
OpenAPI_list_t *versionsList = NULL;
|
||||
cJSON *binding = NULL;
|
||||
notification_type = cJSON_GetObjectItemCaseSensitive(default_notification_subscriptionJSON, "notificationType");
|
||||
if (!notification_type) {
|
||||
ogs_error("OpenAPI_default_notification_subscription_parseFromJSON() failed [notification_type]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_notification_type_e notification_typeVariable;
|
||||
if (!cJSON_IsString(notification_type)) {
|
||||
ogs_error("OpenAPI_default_notification_subscription_parseFromJSON() failed [notification_type]");
|
||||
goto end;
|
||||
}
|
||||
notification_typeVariable = OpenAPI_notification_type_FromString(notification_type->valuestring);
|
||||
|
||||
cJSON *callback_uri = cJSON_GetObjectItemCaseSensitive(default_notification_subscriptionJSON, "callbackUri");
|
||||
callback_uri = cJSON_GetObjectItemCaseSensitive(default_notification_subscriptionJSON, "callbackUri");
|
||||
if (!callback_uri) {
|
||||
ogs_error("OpenAPI_default_notification_subscription_parseFromJSON() failed [callback_uri]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!cJSON_IsString(callback_uri)) {
|
||||
ogs_error("OpenAPI_default_notification_subscription_parseFromJSON() failed [callback_uri]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON *n1_message_class = cJSON_GetObjectItemCaseSensitive(default_notification_subscriptionJSON, "n1MessageClass");
|
||||
|
||||
OpenAPI_n1_message_class_e n1_message_classVariable;
|
||||
n1_message_class = cJSON_GetObjectItemCaseSensitive(default_notification_subscriptionJSON, "n1MessageClass");
|
||||
if (n1_message_class) {
|
||||
if (!cJSON_IsString(n1_message_class)) {
|
||||
ogs_error("OpenAPI_default_notification_subscription_parseFromJSON() failed [n1_message_class]");
|
||||
|
|
@ -140,9 +163,7 @@ OpenAPI_default_notification_subscription_t *OpenAPI_default_notification_subscr
|
|||
n1_message_classVariable = OpenAPI_n1_message_class_FromString(n1_message_class->valuestring);
|
||||
}
|
||||
|
||||
cJSON *n2_information_class = cJSON_GetObjectItemCaseSensitive(default_notification_subscriptionJSON, "n2InformationClass");
|
||||
|
||||
OpenAPI_n2_information_class_e n2_information_classVariable;
|
||||
n2_information_class = cJSON_GetObjectItemCaseSensitive(default_notification_subscriptionJSON, "n2InformationClass");
|
||||
if (n2_information_class) {
|
||||
if (!cJSON_IsString(n2_information_class)) {
|
||||
ogs_error("OpenAPI_default_notification_subscription_parseFromJSON() failed [n2_information_class]");
|
||||
|
|
@ -151,30 +172,30 @@ OpenAPI_default_notification_subscription_t *OpenAPI_default_notification_subscr
|
|||
n2_information_classVariable = OpenAPI_n2_information_class_FromString(n2_information_class->valuestring);
|
||||
}
|
||||
|
||||
cJSON *versions = cJSON_GetObjectItemCaseSensitive(default_notification_subscriptionJSON, "versions");
|
||||
|
||||
OpenAPI_list_t *versionsList;
|
||||
versions = cJSON_GetObjectItemCaseSensitive(default_notification_subscriptionJSON, "versions");
|
||||
if (versions) {
|
||||
cJSON *versions_local;
|
||||
if (!cJSON_IsArray(versions)) {
|
||||
ogs_error("OpenAPI_default_notification_subscription_parseFromJSON() failed [versions]");
|
||||
goto end;
|
||||
}
|
||||
versionsList = OpenAPI_list_create();
|
||||
cJSON *versions_local = NULL;
|
||||
if (!cJSON_IsArray(versions)) {
|
||||
ogs_error("OpenAPI_default_notification_subscription_parseFromJSON() failed [versions]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON_ArrayForEach(versions_local, versions) {
|
||||
if (!cJSON_IsString(versions_local)) {
|
||||
ogs_error("OpenAPI_default_notification_subscription_parseFromJSON() failed [versions]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(versionsList, ogs_strdup(versions_local->valuestring));
|
||||
}
|
||||
versionsList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(versions_local, versions) {
|
||||
double *localDouble = NULL;
|
||||
int *localInt = NULL;
|
||||
if (!cJSON_IsString(versions_local)) {
|
||||
ogs_error("OpenAPI_default_notification_subscription_parseFromJSON() failed [versions]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(versionsList, ogs_strdup(versions_local->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *binding = cJSON_GetObjectItemCaseSensitive(default_notification_subscriptionJSON, "binding");
|
||||
|
||||
binding = cJSON_GetObjectItemCaseSensitive(default_notification_subscriptionJSON, "binding");
|
||||
if (binding) {
|
||||
if (!cJSON_IsString(binding)) {
|
||||
if (!cJSON_IsString(binding) && !cJSON_IsNull(binding)) {
|
||||
ogs_error("OpenAPI_default_notification_subscription_parseFromJSON() failed [binding]");
|
||||
goto end;
|
||||
}
|
||||
|
|
@ -186,11 +207,18 @@ OpenAPI_default_notification_subscription_t *OpenAPI_default_notification_subscr
|
|||
n1_message_class ? n1_message_classVariable : 0,
|
||||
n2_information_class ? n2_information_classVariable : 0,
|
||||
versions ? versionsList : NULL,
|
||||
binding ? ogs_strdup(binding->valuestring) : NULL
|
||||
binding && !cJSON_IsNull(binding) ? ogs_strdup(binding->valuestring) : NULL
|
||||
);
|
||||
|
||||
return default_notification_subscription_local_var;
|
||||
end:
|
||||
if (versionsList) {
|
||||
OpenAPI_list_for_each(versionsList, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(versionsList);
|
||||
versionsList = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue