[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

@ -64,57 +64,128 @@ OpenAPI_pcf_binding_t *OpenAPI_pcf_binding_create(
void OpenAPI_pcf_binding_free(OpenAPI_pcf_binding_t *pcf_binding)
{
OpenAPI_lnode_t *node = NULL;
if (NULL == pcf_binding) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(pcf_binding->supi);
ogs_free(pcf_binding->gpsi);
ogs_free(pcf_binding->ipv4_addr);
ogs_free(pcf_binding->ipv6_prefix);
OpenAPI_list_for_each(pcf_binding->add_ipv6_prefixes, node) {
ogs_free(node->data);
if (pcf_binding->supi) {
ogs_free(pcf_binding->supi);
pcf_binding->supi = NULL;
}
OpenAPI_list_free(pcf_binding->add_ipv6_prefixes);
ogs_free(pcf_binding->ip_domain);
ogs_free(pcf_binding->mac_addr48);
OpenAPI_list_for_each(pcf_binding->add_mac_addrs, node) {
ogs_free(node->data);
if (pcf_binding->gpsi) {
ogs_free(pcf_binding->gpsi);
pcf_binding->gpsi = NULL;
}
OpenAPI_list_free(pcf_binding->add_mac_addrs);
ogs_free(pcf_binding->dnn);
ogs_free(pcf_binding->pcf_fqdn);
OpenAPI_list_for_each(pcf_binding->pcf_ip_end_points, node) {
OpenAPI_ip_end_point_free(node->data);
if (pcf_binding->ipv4_addr) {
ogs_free(pcf_binding->ipv4_addr);
pcf_binding->ipv4_addr = NULL;
}
OpenAPI_list_free(pcf_binding->pcf_ip_end_points);
ogs_free(pcf_binding->pcf_diam_host);
ogs_free(pcf_binding->pcf_diam_realm);
ogs_free(pcf_binding->pcf_sm_fqdn);
OpenAPI_list_for_each(pcf_binding->pcf_sm_ip_end_points, node) {
OpenAPI_ip_end_point_free(node->data);
if (pcf_binding->ipv6_prefix) {
ogs_free(pcf_binding->ipv6_prefix);
pcf_binding->ipv6_prefix = NULL;
}
OpenAPI_list_free(pcf_binding->pcf_sm_ip_end_points);
OpenAPI_snssai_free(pcf_binding->snssai);
ogs_free(pcf_binding->supp_feat);
ogs_free(pcf_binding->pcf_id);
ogs_free(pcf_binding->pcf_set_id);
ogs_free(pcf_binding->recovery_time);
OpenAPI_parameter_combination_free(pcf_binding->para_com);
OpenAPI_list_for_each(pcf_binding->ipv4_frame_route_list, node) {
ogs_free(node->data);
if (pcf_binding->add_ipv6_prefixes) {
OpenAPI_list_for_each(pcf_binding->add_ipv6_prefixes, node) {
ogs_free(node->data);
}
OpenAPI_list_free(pcf_binding->add_ipv6_prefixes);
pcf_binding->add_ipv6_prefixes = NULL;
}
OpenAPI_list_free(pcf_binding->ipv4_frame_route_list);
OpenAPI_list_for_each(pcf_binding->ipv6_frame_route_list, node) {
ogs_free(node->data);
if (pcf_binding->ip_domain) {
ogs_free(pcf_binding->ip_domain);
pcf_binding->ip_domain = NULL;
}
if (pcf_binding->mac_addr48) {
ogs_free(pcf_binding->mac_addr48);
pcf_binding->mac_addr48 = NULL;
}
if (pcf_binding->add_mac_addrs) {
OpenAPI_list_for_each(pcf_binding->add_mac_addrs, node) {
ogs_free(node->data);
}
OpenAPI_list_free(pcf_binding->add_mac_addrs);
pcf_binding->add_mac_addrs = NULL;
}
if (pcf_binding->dnn) {
ogs_free(pcf_binding->dnn);
pcf_binding->dnn = NULL;
}
if (pcf_binding->pcf_fqdn) {
ogs_free(pcf_binding->pcf_fqdn);
pcf_binding->pcf_fqdn = NULL;
}
if (pcf_binding->pcf_ip_end_points) {
OpenAPI_list_for_each(pcf_binding->pcf_ip_end_points, node) {
OpenAPI_ip_end_point_free(node->data);
}
OpenAPI_list_free(pcf_binding->pcf_ip_end_points);
pcf_binding->pcf_ip_end_points = NULL;
}
if (pcf_binding->pcf_diam_host) {
ogs_free(pcf_binding->pcf_diam_host);
pcf_binding->pcf_diam_host = NULL;
}
if (pcf_binding->pcf_diam_realm) {
ogs_free(pcf_binding->pcf_diam_realm);
pcf_binding->pcf_diam_realm = NULL;
}
if (pcf_binding->pcf_sm_fqdn) {
ogs_free(pcf_binding->pcf_sm_fqdn);
pcf_binding->pcf_sm_fqdn = NULL;
}
if (pcf_binding->pcf_sm_ip_end_points) {
OpenAPI_list_for_each(pcf_binding->pcf_sm_ip_end_points, node) {
OpenAPI_ip_end_point_free(node->data);
}
OpenAPI_list_free(pcf_binding->pcf_sm_ip_end_points);
pcf_binding->pcf_sm_ip_end_points = NULL;
}
if (pcf_binding->snssai) {
OpenAPI_snssai_free(pcf_binding->snssai);
pcf_binding->snssai = NULL;
}
if (pcf_binding->supp_feat) {
ogs_free(pcf_binding->supp_feat);
pcf_binding->supp_feat = NULL;
}
if (pcf_binding->pcf_id) {
ogs_free(pcf_binding->pcf_id);
pcf_binding->pcf_id = NULL;
}
if (pcf_binding->pcf_set_id) {
ogs_free(pcf_binding->pcf_set_id);
pcf_binding->pcf_set_id = NULL;
}
if (pcf_binding->recovery_time) {
ogs_free(pcf_binding->recovery_time);
pcf_binding->recovery_time = NULL;
}
if (pcf_binding->para_com) {
OpenAPI_parameter_combination_free(pcf_binding->para_com);
pcf_binding->para_com = NULL;
}
if (pcf_binding->ipv4_frame_route_list) {
OpenAPI_list_for_each(pcf_binding->ipv4_frame_route_list, node) {
ogs_free(node->data);
}
OpenAPI_list_free(pcf_binding->ipv4_frame_route_list);
pcf_binding->ipv4_frame_route_list = NULL;
}
if (pcf_binding->ipv6_frame_route_list) {
OpenAPI_list_for_each(pcf_binding->ipv6_frame_route_list, node) {
ogs_free(node->data);
}
OpenAPI_list_free(pcf_binding->ipv6_frame_route_list);
pcf_binding->ipv6_frame_route_list = NULL;
}
OpenAPI_list_free(pcf_binding->ipv6_frame_route_list);
ogs_free(pcf_binding);
}
cJSON *OpenAPI_pcf_binding_convertToJSON(OpenAPI_pcf_binding_t *pcf_binding)
{
cJSON *item = NULL;
OpenAPI_lnode_t *node = NULL;
if (pcf_binding == NULL) {
ogs_error("OpenAPI_pcf_binding_convertToJSON() failed [PcfBinding]");
@ -151,19 +222,17 @@ cJSON *OpenAPI_pcf_binding_convertToJSON(OpenAPI_pcf_binding_t *pcf_binding)
}
if (pcf_binding->add_ipv6_prefixes) {
cJSON *add_ipv6_prefixes = cJSON_AddArrayToObject(item, "addIpv6Prefixes");
if (add_ipv6_prefixes == NULL) {
cJSON *add_ipv6_prefixesList = cJSON_AddArrayToObject(item, "addIpv6Prefixes");
if (add_ipv6_prefixesList == NULL) {
ogs_error("OpenAPI_pcf_binding_convertToJSON() failed [add_ipv6_prefixes]");
goto end;
}
OpenAPI_lnode_t *add_ipv6_prefixes_node;
OpenAPI_list_for_each(pcf_binding->add_ipv6_prefixes, add_ipv6_prefixes_node) {
if (cJSON_AddStringToObject(add_ipv6_prefixes, "", (char*)add_ipv6_prefixes_node->data) == NULL) {
ogs_error("OpenAPI_pcf_binding_convertToJSON() failed [add_ipv6_prefixes]");
goto end;
OpenAPI_list_for_each(pcf_binding->add_ipv6_prefixes, node) {
if (cJSON_AddStringToObject(add_ipv6_prefixesList, "", (char*)node->data) == NULL) {
ogs_error("OpenAPI_pcf_binding_convertToJSON() failed [add_ipv6_prefixes]");
goto end;
}
}
}
}
if (pcf_binding->ip_domain) {
@ -181,21 +250,23 @@ cJSON *OpenAPI_pcf_binding_convertToJSON(OpenAPI_pcf_binding_t *pcf_binding)
}
if (pcf_binding->add_mac_addrs) {
cJSON *add_mac_addrs = cJSON_AddArrayToObject(item, "addMacAddrs");
if (add_mac_addrs == NULL) {
cJSON *add_mac_addrsList = cJSON_AddArrayToObject(item, "addMacAddrs");
if (add_mac_addrsList == NULL) {
ogs_error("OpenAPI_pcf_binding_convertToJSON() failed [add_mac_addrs]");
goto end;
}
OpenAPI_lnode_t *add_mac_addrs_node;
OpenAPI_list_for_each(pcf_binding->add_mac_addrs, add_mac_addrs_node) {
if (cJSON_AddStringToObject(add_mac_addrs, "", (char*)add_mac_addrs_node->data) == NULL) {
ogs_error("OpenAPI_pcf_binding_convertToJSON() failed [add_mac_addrs]");
goto end;
OpenAPI_list_for_each(pcf_binding->add_mac_addrs, node) {
if (cJSON_AddStringToObject(add_mac_addrsList, "", (char*)node->data) == NULL) {
ogs_error("OpenAPI_pcf_binding_convertToJSON() failed [add_mac_addrs]");
goto end;
}
}
}
}
if (!pcf_binding->dnn) {
ogs_error("OpenAPI_pcf_binding_convertToJSON() failed [dnn]");
return NULL;
}
if (cJSON_AddStringToObject(item, "dnn", pcf_binding->dnn) == NULL) {
ogs_error("OpenAPI_pcf_binding_convertToJSON() failed [dnn]");
goto end;
@ -214,17 +285,13 @@ cJSON *OpenAPI_pcf_binding_convertToJSON(OpenAPI_pcf_binding_t *pcf_binding)
ogs_error("OpenAPI_pcf_binding_convertToJSON() failed [pcf_ip_end_points]");
goto end;
}
OpenAPI_lnode_t *pcf_ip_end_points_node;
if (pcf_binding->pcf_ip_end_points) {
OpenAPI_list_for_each(pcf_binding->pcf_ip_end_points, pcf_ip_end_points_node) {
cJSON *itemLocal = OpenAPI_ip_end_point_convertToJSON(pcf_ip_end_points_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_pcf_binding_convertToJSON() failed [pcf_ip_end_points]");
goto end;
}
cJSON_AddItemToArray(pcf_ip_end_pointsList, itemLocal);
OpenAPI_list_for_each(pcf_binding->pcf_ip_end_points, node) {
cJSON *itemLocal = OpenAPI_ip_end_point_convertToJSON(node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_pcf_binding_convertToJSON() failed [pcf_ip_end_points]");
goto end;
}
cJSON_AddItemToArray(pcf_ip_end_pointsList, itemLocal);
}
}
@ -255,20 +322,20 @@ cJSON *OpenAPI_pcf_binding_convertToJSON(OpenAPI_pcf_binding_t *pcf_binding)
ogs_error("OpenAPI_pcf_binding_convertToJSON() failed [pcf_sm_ip_end_points]");
goto end;
}
OpenAPI_lnode_t *pcf_sm_ip_end_points_node;
if (pcf_binding->pcf_sm_ip_end_points) {
OpenAPI_list_for_each(pcf_binding->pcf_sm_ip_end_points, pcf_sm_ip_end_points_node) {
cJSON *itemLocal = OpenAPI_ip_end_point_convertToJSON(pcf_sm_ip_end_points_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_pcf_binding_convertToJSON() failed [pcf_sm_ip_end_points]");
goto end;
}
cJSON_AddItemToArray(pcf_sm_ip_end_pointsList, itemLocal);
OpenAPI_list_for_each(pcf_binding->pcf_sm_ip_end_points, node) {
cJSON *itemLocal = OpenAPI_ip_end_point_convertToJSON(node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_pcf_binding_convertToJSON() failed [pcf_sm_ip_end_points]");
goto end;
}
cJSON_AddItemToArray(pcf_sm_ip_end_pointsList, itemLocal);
}
}
if (!pcf_binding->snssai) {
ogs_error("OpenAPI_pcf_binding_convertToJSON() failed [snssai]");
return NULL;
}
cJSON *snssai_local_JSON = OpenAPI_snssai_convertToJSON(pcf_binding->snssai);
if (snssai_local_JSON == NULL) {
ogs_error("OpenAPI_pcf_binding_convertToJSON() failed [snssai]");
@ -321,7 +388,7 @@ cJSON *OpenAPI_pcf_binding_convertToJSON(OpenAPI_pcf_binding_t *pcf_binding)
}
}
if (pcf_binding->bind_level) {
if (pcf_binding->bind_level != OpenAPI_binding_level_NULL) {
if (cJSON_AddStringToObject(item, "bindLevel", OpenAPI_binding_level_ToString(pcf_binding->bind_level)) == NULL) {
ogs_error("OpenAPI_pcf_binding_convertToJSON() failed [bind_level]");
goto end;
@ -329,35 +396,31 @@ cJSON *OpenAPI_pcf_binding_convertToJSON(OpenAPI_pcf_binding_t *pcf_binding)
}
if (pcf_binding->ipv4_frame_route_list) {
cJSON *ipv4_frame_route_list = cJSON_AddArrayToObject(item, "ipv4FrameRouteList");
if (ipv4_frame_route_list == NULL) {
cJSON *ipv4_frame_route_listList = cJSON_AddArrayToObject(item, "ipv4FrameRouteList");
if (ipv4_frame_route_listList == NULL) {
ogs_error("OpenAPI_pcf_binding_convertToJSON() failed [ipv4_frame_route_list]");
goto end;
}
OpenAPI_lnode_t *ipv4_frame_route_list_node;
OpenAPI_list_for_each(pcf_binding->ipv4_frame_route_list, ipv4_frame_route_list_node) {
if (cJSON_AddStringToObject(ipv4_frame_route_list, "", (char*)ipv4_frame_route_list_node->data) == NULL) {
ogs_error("OpenAPI_pcf_binding_convertToJSON() failed [ipv4_frame_route_list]");
goto end;
OpenAPI_list_for_each(pcf_binding->ipv4_frame_route_list, node) {
if (cJSON_AddStringToObject(ipv4_frame_route_listList, "", (char*)node->data) == NULL) {
ogs_error("OpenAPI_pcf_binding_convertToJSON() failed [ipv4_frame_route_list]");
goto end;
}
}
}
}
if (pcf_binding->ipv6_frame_route_list) {
cJSON *ipv6_frame_route_list = cJSON_AddArrayToObject(item, "ipv6FrameRouteList");
if (ipv6_frame_route_list == NULL) {
cJSON *ipv6_frame_route_listList = cJSON_AddArrayToObject(item, "ipv6FrameRouteList");
if (ipv6_frame_route_listList == NULL) {
ogs_error("OpenAPI_pcf_binding_convertToJSON() failed [ipv6_frame_route_list]");
goto end;
}
OpenAPI_lnode_t *ipv6_frame_route_list_node;
OpenAPI_list_for_each(pcf_binding->ipv6_frame_route_list, ipv6_frame_route_list_node) {
if (cJSON_AddStringToObject(ipv6_frame_route_list, "", (char*)ipv6_frame_route_list_node->data) == NULL) {
ogs_error("OpenAPI_pcf_binding_convertToJSON() failed [ipv6_frame_route_list]");
goto end;
OpenAPI_list_for_each(pcf_binding->ipv6_frame_route_list, node) {
if (cJSON_AddStringToObject(ipv6_frame_route_listList, "", (char*)node->data) == NULL) {
ogs_error("OpenAPI_pcf_binding_convertToJSON() failed [ipv6_frame_route_list]");
goto end;
}
}
}
}
end:
@ -367,260 +430,267 @@ end:
OpenAPI_pcf_binding_t *OpenAPI_pcf_binding_parseFromJSON(cJSON *pcf_bindingJSON)
{
OpenAPI_pcf_binding_t *pcf_binding_local_var = NULL;
cJSON *supi = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "supi");
OpenAPI_lnode_t *node = NULL;
cJSON *supi = NULL;
cJSON *gpsi = NULL;
cJSON *ipv4_addr = NULL;
cJSON *ipv6_prefix = NULL;
cJSON *add_ipv6_prefixes = NULL;
OpenAPI_list_t *add_ipv6_prefixesList = NULL;
cJSON *ip_domain = NULL;
cJSON *mac_addr48 = NULL;
cJSON *add_mac_addrs = NULL;
OpenAPI_list_t *add_mac_addrsList = NULL;
cJSON *dnn = NULL;
cJSON *pcf_fqdn = NULL;
cJSON *pcf_ip_end_points = NULL;
OpenAPI_list_t *pcf_ip_end_pointsList = NULL;
cJSON *pcf_diam_host = NULL;
cJSON *pcf_diam_realm = NULL;
cJSON *pcf_sm_fqdn = NULL;
cJSON *pcf_sm_ip_end_points = NULL;
OpenAPI_list_t *pcf_sm_ip_end_pointsList = NULL;
cJSON *snssai = NULL;
OpenAPI_snssai_t *snssai_local_nonprim = NULL;
cJSON *supp_feat = NULL;
cJSON *pcf_id = NULL;
cJSON *pcf_set_id = NULL;
cJSON *recovery_time = NULL;
cJSON *para_com = NULL;
OpenAPI_parameter_combination_t *para_com_local_nonprim = NULL;
cJSON *bind_level = NULL;
OpenAPI_binding_level_e bind_levelVariable = 0;
cJSON *ipv4_frame_route_list = NULL;
OpenAPI_list_t *ipv4_frame_route_listList = NULL;
cJSON *ipv6_frame_route_list = NULL;
OpenAPI_list_t *ipv6_frame_route_listList = NULL;
supi = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "supi");
if (supi) {
if (!cJSON_IsString(supi)) {
if (!cJSON_IsString(supi) && !cJSON_IsNull(supi)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [supi]");
goto end;
}
}
cJSON *gpsi = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "gpsi");
gpsi = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "gpsi");
if (gpsi) {
if (!cJSON_IsString(gpsi)) {
if (!cJSON_IsString(gpsi) && !cJSON_IsNull(gpsi)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [gpsi]");
goto end;
}
}
cJSON *ipv4_addr = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "ipv4Addr");
ipv4_addr = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "ipv4Addr");
if (ipv4_addr) {
if (!cJSON_IsString(ipv4_addr)) {
if (!cJSON_IsString(ipv4_addr) && !cJSON_IsNull(ipv4_addr)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [ipv4_addr]");
goto end;
}
}
cJSON *ipv6_prefix = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "ipv6Prefix");
ipv6_prefix = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "ipv6Prefix");
if (ipv6_prefix) {
if (!cJSON_IsString(ipv6_prefix)) {
if (!cJSON_IsString(ipv6_prefix) && !cJSON_IsNull(ipv6_prefix)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [ipv6_prefix]");
goto end;
}
}
cJSON *add_ipv6_prefixes = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "addIpv6Prefixes");
OpenAPI_list_t *add_ipv6_prefixesList;
add_ipv6_prefixes = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "addIpv6Prefixes");
if (add_ipv6_prefixes) {
cJSON *add_ipv6_prefixes_local;
if (!cJSON_IsArray(add_ipv6_prefixes)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [add_ipv6_prefixes]");
goto end;
}
add_ipv6_prefixesList = OpenAPI_list_create();
cJSON *add_ipv6_prefixes_local = NULL;
if (!cJSON_IsArray(add_ipv6_prefixes)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [add_ipv6_prefixes]");
goto end;
}
cJSON_ArrayForEach(add_ipv6_prefixes_local, add_ipv6_prefixes) {
if (!cJSON_IsString(add_ipv6_prefixes_local)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [add_ipv6_prefixes]");
goto end;
}
OpenAPI_list_add(add_ipv6_prefixesList, ogs_strdup(add_ipv6_prefixes_local->valuestring));
}
add_ipv6_prefixesList = OpenAPI_list_create();
cJSON_ArrayForEach(add_ipv6_prefixes_local, add_ipv6_prefixes) {
double *localDouble = NULL;
int *localInt = NULL;
if (!cJSON_IsString(add_ipv6_prefixes_local)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [add_ipv6_prefixes]");
goto end;
}
OpenAPI_list_add(add_ipv6_prefixesList, ogs_strdup(add_ipv6_prefixes_local->valuestring));
}
}
cJSON *ip_domain = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "ipDomain");
ip_domain = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "ipDomain");
if (ip_domain) {
if (!cJSON_IsString(ip_domain)) {
if (!cJSON_IsString(ip_domain) && !cJSON_IsNull(ip_domain)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [ip_domain]");
goto end;
}
}
cJSON *mac_addr48 = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "macAddr48");
mac_addr48 = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "macAddr48");
if (mac_addr48) {
if (!cJSON_IsString(mac_addr48)) {
if (!cJSON_IsString(mac_addr48) && !cJSON_IsNull(mac_addr48)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [mac_addr48]");
goto end;
}
}
cJSON *add_mac_addrs = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "addMacAddrs");
OpenAPI_list_t *add_mac_addrsList;
add_mac_addrs = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "addMacAddrs");
if (add_mac_addrs) {
cJSON *add_mac_addrs_local;
if (!cJSON_IsArray(add_mac_addrs)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [add_mac_addrs]");
goto end;
}
add_mac_addrsList = OpenAPI_list_create();
cJSON *add_mac_addrs_local = NULL;
if (!cJSON_IsArray(add_mac_addrs)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [add_mac_addrs]");
goto end;
}
cJSON_ArrayForEach(add_mac_addrs_local, add_mac_addrs) {
if (!cJSON_IsString(add_mac_addrs_local)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [add_mac_addrs]");
goto end;
}
OpenAPI_list_add(add_mac_addrsList, ogs_strdup(add_mac_addrs_local->valuestring));
}
add_mac_addrsList = OpenAPI_list_create();
cJSON_ArrayForEach(add_mac_addrs_local, add_mac_addrs) {
double *localDouble = NULL;
int *localInt = NULL;
if (!cJSON_IsString(add_mac_addrs_local)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [add_mac_addrs]");
goto end;
}
OpenAPI_list_add(add_mac_addrsList, ogs_strdup(add_mac_addrs_local->valuestring));
}
}
cJSON *dnn = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "dnn");
dnn = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "dnn");
if (!dnn) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [dnn]");
goto end;
}
if (!cJSON_IsString(dnn)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [dnn]");
goto end;
}
cJSON *pcf_fqdn = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "pcfFqdn");
pcf_fqdn = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "pcfFqdn");
if (pcf_fqdn) {
if (!cJSON_IsString(pcf_fqdn)) {
if (!cJSON_IsString(pcf_fqdn) && !cJSON_IsNull(pcf_fqdn)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [pcf_fqdn]");
goto end;
}
}
cJSON *pcf_ip_end_points = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "pcfIpEndPoints");
OpenAPI_list_t *pcf_ip_end_pointsList;
pcf_ip_end_points = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "pcfIpEndPoints");
if (pcf_ip_end_points) {
cJSON *pcf_ip_end_points_local_nonprimitive;
if (!cJSON_IsArray(pcf_ip_end_points)){
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [pcf_ip_end_points]");
goto end;
}
pcf_ip_end_pointsList = OpenAPI_list_create();
cJSON_ArrayForEach(pcf_ip_end_points_local_nonprimitive, pcf_ip_end_points ) {
if (!cJSON_IsObject(pcf_ip_end_points_local_nonprimitive)) {
cJSON *pcf_ip_end_points_local = NULL;
if (!cJSON_IsArray(pcf_ip_end_points)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [pcf_ip_end_points]");
goto end;
}
OpenAPI_ip_end_point_t *pcf_ip_end_pointsItem = OpenAPI_ip_end_point_parseFromJSON(pcf_ip_end_points_local_nonprimitive);
if (!pcf_ip_end_pointsItem) {
ogs_error("No pcf_ip_end_pointsItem");
OpenAPI_list_free(pcf_ip_end_pointsList);
goto end;
pcf_ip_end_pointsList = OpenAPI_list_create();
cJSON_ArrayForEach(pcf_ip_end_points_local, pcf_ip_end_points) {
if (!cJSON_IsObject(pcf_ip_end_points_local)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [pcf_ip_end_points]");
goto end;
}
OpenAPI_ip_end_point_t *pcf_ip_end_pointsItem = OpenAPI_ip_end_point_parseFromJSON(pcf_ip_end_points_local);
if (!pcf_ip_end_pointsItem) {
ogs_error("No pcf_ip_end_pointsItem");
OpenAPI_list_free(pcf_ip_end_pointsList);
goto end;
}
OpenAPI_list_add(pcf_ip_end_pointsList, pcf_ip_end_pointsItem);
}
OpenAPI_list_add(pcf_ip_end_pointsList, pcf_ip_end_pointsItem);
}
}
cJSON *pcf_diam_host = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "pcfDiamHost");
pcf_diam_host = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "pcfDiamHost");
if (pcf_diam_host) {
if (!cJSON_IsString(pcf_diam_host)) {
if (!cJSON_IsString(pcf_diam_host) && !cJSON_IsNull(pcf_diam_host)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [pcf_diam_host]");
goto end;
}
}
cJSON *pcf_diam_realm = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "pcfDiamRealm");
pcf_diam_realm = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "pcfDiamRealm");
if (pcf_diam_realm) {
if (!cJSON_IsString(pcf_diam_realm)) {
if (!cJSON_IsString(pcf_diam_realm) && !cJSON_IsNull(pcf_diam_realm)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [pcf_diam_realm]");
goto end;
}
}
cJSON *pcf_sm_fqdn = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "pcfSmFqdn");
pcf_sm_fqdn = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "pcfSmFqdn");
if (pcf_sm_fqdn) {
if (!cJSON_IsString(pcf_sm_fqdn)) {
if (!cJSON_IsString(pcf_sm_fqdn) && !cJSON_IsNull(pcf_sm_fqdn)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [pcf_sm_fqdn]");
goto end;
}
}
cJSON *pcf_sm_ip_end_points = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "pcfSmIpEndPoints");
OpenAPI_list_t *pcf_sm_ip_end_pointsList;
pcf_sm_ip_end_points = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "pcfSmIpEndPoints");
if (pcf_sm_ip_end_points) {
cJSON *pcf_sm_ip_end_points_local_nonprimitive;
if (!cJSON_IsArray(pcf_sm_ip_end_points)){
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [pcf_sm_ip_end_points]");
goto end;
}
pcf_sm_ip_end_pointsList = OpenAPI_list_create();
cJSON_ArrayForEach(pcf_sm_ip_end_points_local_nonprimitive, pcf_sm_ip_end_points ) {
if (!cJSON_IsObject(pcf_sm_ip_end_points_local_nonprimitive)) {
cJSON *pcf_sm_ip_end_points_local = NULL;
if (!cJSON_IsArray(pcf_sm_ip_end_points)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [pcf_sm_ip_end_points]");
goto end;
}
OpenAPI_ip_end_point_t *pcf_sm_ip_end_pointsItem = OpenAPI_ip_end_point_parseFromJSON(pcf_sm_ip_end_points_local_nonprimitive);
if (!pcf_sm_ip_end_pointsItem) {
ogs_error("No pcf_sm_ip_end_pointsItem");
OpenAPI_list_free(pcf_sm_ip_end_pointsList);
goto end;
pcf_sm_ip_end_pointsList = OpenAPI_list_create();
cJSON_ArrayForEach(pcf_sm_ip_end_points_local, pcf_sm_ip_end_points) {
if (!cJSON_IsObject(pcf_sm_ip_end_points_local)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [pcf_sm_ip_end_points]");
goto end;
}
OpenAPI_ip_end_point_t *pcf_sm_ip_end_pointsItem = OpenAPI_ip_end_point_parseFromJSON(pcf_sm_ip_end_points_local);
if (!pcf_sm_ip_end_pointsItem) {
ogs_error("No pcf_sm_ip_end_pointsItem");
OpenAPI_list_free(pcf_sm_ip_end_pointsList);
goto end;
}
OpenAPI_list_add(pcf_sm_ip_end_pointsList, pcf_sm_ip_end_pointsItem);
}
OpenAPI_list_add(pcf_sm_ip_end_pointsList, pcf_sm_ip_end_pointsItem);
}
}
cJSON *snssai = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "snssai");
snssai = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "snssai");
if (!snssai) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [snssai]");
goto end;
}
OpenAPI_snssai_t *snssai_local_nonprim = NULL;
snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(snssai);
cJSON *supp_feat = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "suppFeat");
supp_feat = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "suppFeat");
if (supp_feat) {
if (!cJSON_IsString(supp_feat)) {
if (!cJSON_IsString(supp_feat) && !cJSON_IsNull(supp_feat)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [supp_feat]");
goto end;
}
}
cJSON *pcf_id = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "pcfId");
pcf_id = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "pcfId");
if (pcf_id) {
if (!cJSON_IsString(pcf_id)) {
if (!cJSON_IsString(pcf_id) && !cJSON_IsNull(pcf_id)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [pcf_id]");
goto end;
}
}
cJSON *pcf_set_id = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "pcfSetId");
pcf_set_id = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "pcfSetId");
if (pcf_set_id) {
if (!cJSON_IsString(pcf_set_id)) {
if (!cJSON_IsString(pcf_set_id) && !cJSON_IsNull(pcf_set_id)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [pcf_set_id]");
goto end;
}
}
cJSON *recovery_time = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "recoveryTime");
recovery_time = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "recoveryTime");
if (recovery_time) {
if (!cJSON_IsString(recovery_time)) {
if (!cJSON_IsString(recovery_time) && !cJSON_IsNull(recovery_time)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [recovery_time]");
goto end;
}
}
cJSON *para_com = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "paraCom");
OpenAPI_parameter_combination_t *para_com_local_nonprim = NULL;
para_com = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "paraCom");
if (para_com) {
para_com_local_nonprim = OpenAPI_parameter_combination_parseFromJSON(para_com);
}
cJSON *bind_level = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "bindLevel");
OpenAPI_binding_level_e bind_levelVariable;
bind_level = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "bindLevel");
if (bind_level) {
if (!cJSON_IsString(bind_level)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [bind_level]");
@ -629,67 +699,69 @@ OpenAPI_pcf_binding_t *OpenAPI_pcf_binding_parseFromJSON(cJSON *pcf_bindingJSON)
bind_levelVariable = OpenAPI_binding_level_FromString(bind_level->valuestring);
}
cJSON *ipv4_frame_route_list = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "ipv4FrameRouteList");
OpenAPI_list_t *ipv4_frame_route_listList;
ipv4_frame_route_list = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "ipv4FrameRouteList");
if (ipv4_frame_route_list) {
cJSON *ipv4_frame_route_list_local;
if (!cJSON_IsArray(ipv4_frame_route_list)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [ipv4_frame_route_list]");
goto end;
}
ipv4_frame_route_listList = OpenAPI_list_create();
cJSON *ipv4_frame_route_list_local = NULL;
if (!cJSON_IsArray(ipv4_frame_route_list)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [ipv4_frame_route_list]");
goto end;
}
cJSON_ArrayForEach(ipv4_frame_route_list_local, ipv4_frame_route_list) {
if (!cJSON_IsString(ipv4_frame_route_list_local)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [ipv4_frame_route_list]");
goto end;
}
OpenAPI_list_add(ipv4_frame_route_listList, ogs_strdup(ipv4_frame_route_list_local->valuestring));
}
ipv4_frame_route_listList = OpenAPI_list_create();
cJSON_ArrayForEach(ipv4_frame_route_list_local, ipv4_frame_route_list) {
double *localDouble = NULL;
int *localInt = NULL;
if (!cJSON_IsString(ipv4_frame_route_list_local)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [ipv4_frame_route_list]");
goto end;
}
OpenAPI_list_add(ipv4_frame_route_listList, ogs_strdup(ipv4_frame_route_list_local->valuestring));
}
}
cJSON *ipv6_frame_route_list = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "ipv6FrameRouteList");
OpenAPI_list_t *ipv6_frame_route_listList;
ipv6_frame_route_list = cJSON_GetObjectItemCaseSensitive(pcf_bindingJSON, "ipv6FrameRouteList");
if (ipv6_frame_route_list) {
cJSON *ipv6_frame_route_list_local;
if (!cJSON_IsArray(ipv6_frame_route_list)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [ipv6_frame_route_list]");
goto end;
}
ipv6_frame_route_listList = OpenAPI_list_create();
cJSON *ipv6_frame_route_list_local = NULL;
if (!cJSON_IsArray(ipv6_frame_route_list)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [ipv6_frame_route_list]");
goto end;
}
cJSON_ArrayForEach(ipv6_frame_route_list_local, ipv6_frame_route_list) {
if (!cJSON_IsString(ipv6_frame_route_list_local)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [ipv6_frame_route_list]");
goto end;
}
OpenAPI_list_add(ipv6_frame_route_listList, ogs_strdup(ipv6_frame_route_list_local->valuestring));
}
ipv6_frame_route_listList = OpenAPI_list_create();
cJSON_ArrayForEach(ipv6_frame_route_list_local, ipv6_frame_route_list) {
double *localDouble = NULL;
int *localInt = NULL;
if (!cJSON_IsString(ipv6_frame_route_list_local)) {
ogs_error("OpenAPI_pcf_binding_parseFromJSON() failed [ipv6_frame_route_list]");
goto end;
}
OpenAPI_list_add(ipv6_frame_route_listList, ogs_strdup(ipv6_frame_route_list_local->valuestring));
}
}
pcf_binding_local_var = OpenAPI_pcf_binding_create (
supi ? ogs_strdup(supi->valuestring) : NULL,
gpsi ? ogs_strdup(gpsi->valuestring) : NULL,
ipv4_addr ? ogs_strdup(ipv4_addr->valuestring) : NULL,
ipv6_prefix ? ogs_strdup(ipv6_prefix->valuestring) : NULL,
supi && !cJSON_IsNull(supi) ? ogs_strdup(supi->valuestring) : NULL,
gpsi && !cJSON_IsNull(gpsi) ? ogs_strdup(gpsi->valuestring) : NULL,
ipv4_addr && !cJSON_IsNull(ipv4_addr) ? ogs_strdup(ipv4_addr->valuestring) : NULL,
ipv6_prefix && !cJSON_IsNull(ipv6_prefix) ? ogs_strdup(ipv6_prefix->valuestring) : NULL,
add_ipv6_prefixes ? add_ipv6_prefixesList : NULL,
ip_domain ? ogs_strdup(ip_domain->valuestring) : NULL,
mac_addr48 ? ogs_strdup(mac_addr48->valuestring) : NULL,
ip_domain && !cJSON_IsNull(ip_domain) ? ogs_strdup(ip_domain->valuestring) : NULL,
mac_addr48 && !cJSON_IsNull(mac_addr48) ? ogs_strdup(mac_addr48->valuestring) : NULL,
add_mac_addrs ? add_mac_addrsList : NULL,
ogs_strdup(dnn->valuestring),
pcf_fqdn ? ogs_strdup(pcf_fqdn->valuestring) : NULL,
pcf_fqdn && !cJSON_IsNull(pcf_fqdn) ? ogs_strdup(pcf_fqdn->valuestring) : NULL,
pcf_ip_end_points ? pcf_ip_end_pointsList : NULL,
pcf_diam_host ? ogs_strdup(pcf_diam_host->valuestring) : NULL,
pcf_diam_realm ? ogs_strdup(pcf_diam_realm->valuestring) : NULL,
pcf_sm_fqdn ? ogs_strdup(pcf_sm_fqdn->valuestring) : NULL,
pcf_diam_host && !cJSON_IsNull(pcf_diam_host) ? ogs_strdup(pcf_diam_host->valuestring) : NULL,
pcf_diam_realm && !cJSON_IsNull(pcf_diam_realm) ? ogs_strdup(pcf_diam_realm->valuestring) : NULL,
pcf_sm_fqdn && !cJSON_IsNull(pcf_sm_fqdn) ? ogs_strdup(pcf_sm_fqdn->valuestring) : NULL,
pcf_sm_ip_end_points ? pcf_sm_ip_end_pointsList : NULL,
snssai_local_nonprim,
supp_feat ? ogs_strdup(supp_feat->valuestring) : NULL,
pcf_id ? ogs_strdup(pcf_id->valuestring) : NULL,
pcf_set_id ? ogs_strdup(pcf_set_id->valuestring) : NULL,
recovery_time ? ogs_strdup(recovery_time->valuestring) : NULL,
supp_feat && !cJSON_IsNull(supp_feat) ? ogs_strdup(supp_feat->valuestring) : NULL,
pcf_id && !cJSON_IsNull(pcf_id) ? ogs_strdup(pcf_id->valuestring) : NULL,
pcf_set_id && !cJSON_IsNull(pcf_set_id) ? ogs_strdup(pcf_set_id->valuestring) : NULL,
recovery_time && !cJSON_IsNull(recovery_time) ? ogs_strdup(recovery_time->valuestring) : NULL,
para_com ? para_com_local_nonprim : NULL,
bind_level ? bind_levelVariable : 0,
ipv4_frame_route_list ? ipv4_frame_route_listList : NULL,
@ -698,6 +770,56 @@ OpenAPI_pcf_binding_t *OpenAPI_pcf_binding_parseFromJSON(cJSON *pcf_bindingJSON)
return pcf_binding_local_var;
end:
if (add_ipv6_prefixesList) {
OpenAPI_list_for_each(add_ipv6_prefixesList, node) {
ogs_free(node->data);
}
OpenAPI_list_free(add_ipv6_prefixesList);
add_ipv6_prefixesList = NULL;
}
if (add_mac_addrsList) {
OpenAPI_list_for_each(add_mac_addrsList, node) {
ogs_free(node->data);
}
OpenAPI_list_free(add_mac_addrsList);
add_mac_addrsList = NULL;
}
if (pcf_ip_end_pointsList) {
OpenAPI_list_for_each(pcf_ip_end_pointsList, node) {
OpenAPI_ip_end_point_free(node->data);
}
OpenAPI_list_free(pcf_ip_end_pointsList);
pcf_ip_end_pointsList = NULL;
}
if (pcf_sm_ip_end_pointsList) {
OpenAPI_list_for_each(pcf_sm_ip_end_pointsList, node) {
OpenAPI_ip_end_point_free(node->data);
}
OpenAPI_list_free(pcf_sm_ip_end_pointsList);
pcf_sm_ip_end_pointsList = NULL;
}
if (snssai_local_nonprim) {
OpenAPI_snssai_free(snssai_local_nonprim);
snssai_local_nonprim = NULL;
}
if (para_com_local_nonprim) {
OpenAPI_parameter_combination_free(para_com_local_nonprim);
para_com_local_nonprim = NULL;
}
if (ipv4_frame_route_listList) {
OpenAPI_list_for_each(ipv4_frame_route_listList, node) {
ogs_free(node->data);
}
OpenAPI_list_free(ipv4_frame_route_listList);
ipv4_frame_route_listList = NULL;
}
if (ipv6_frame_route_listList) {
OpenAPI_list_for_each(ipv6_frame_route_listList, node) {
ogs_free(node->data);
}
OpenAPI_list_free(ipv6_frame_route_listList);
ipv6_frame_route_listList = NULL;
}
return NULL;
}