2020-12-11 19:03:20 +00:00
# include <stdlib.h>
# include <string.h>
# include <stdio.h>
# include "sm_policy_decision.h"
OpenAPI_sm_policy_decision_t * OpenAPI_sm_policy_decision_create (
OpenAPI_list_t * sess_rules ,
2023-10-05 11:39:14 +00:00
bool is_pcc_rules_null ,
2020-12-11 19:03:20 +00:00
OpenAPI_list_t * pcc_rules ,
2021-07-16 08:02:33 +00:00
bool is_pcscf_rest_indication ,
2020-12-11 19:03:20 +00:00
int pcscf_rest_indication ,
OpenAPI_list_t * qos_decs ,
2023-10-05 11:39:14 +00:00
bool is_chg_decs_null ,
2020-12-11 19:03:20 +00:00
OpenAPI_list_t * chg_decs ,
OpenAPI_charging_information_t * charging_info ,
OpenAPI_list_t * traff_cont_decs ,
2023-10-05 11:39:14 +00:00
bool is_um_decs_null ,
2020-12-11 19:03:20 +00:00
OpenAPI_list_t * um_decs ,
OpenAPI_list_t * qos_chars ,
2023-10-05 11:39:14 +00:00
bool is_qos_mon_decs_null ,
2020-12-11 19:03:20 +00:00
OpenAPI_list_t * qos_mon_decs ,
2021-07-16 08:02:33 +00:00
bool is_reflective_qo_s_timer ,
2020-12-11 19:03:20 +00:00
int reflective_qo_s_timer ,
2023-10-05 11:39:14 +00:00
bool is_conds_null ,
2020-12-11 19:03:20 +00:00
OpenAPI_list_t * conds ,
char * revalidation_time ,
2021-07-16 08:02:33 +00:00
bool is_offline ,
2020-12-11 19:03:20 +00:00
int offline ,
2021-07-16 08:02:33 +00:00
bool is_online ,
2020-12-11 19:03:20 +00:00
int online ,
2023-03-01 10:56:49 +00:00
bool is_offline_ch_only ,
int offline_ch_only ,
2023-10-05 11:39:14 +00:00
bool is_policy_ctrl_req_triggers_null ,
2020-12-11 19:03:20 +00:00
OpenAPI_list_t * policy_ctrl_req_triggers ,
OpenAPI_list_t * last_req_rule_data ,
OpenAPI_requested_usage_data_t * last_req_usage_data ,
2023-10-05 11:39:14 +00:00
bool is_pra_infos_null ,
2020-12-11 19:03:20 +00:00
OpenAPI_list_t * pra_infos ,
2021-07-16 08:02:33 +00:00
bool is_ipv4_index ,
2020-12-11 19:03:20 +00:00
int ipv4_index ,
2021-07-16 08:02:33 +00:00
bool is_ipv6_index ,
2020-12-11 19:03:20 +00:00
int ipv6_index ,
2021-01-01 02:07:08 +00:00
OpenAPI_qos_flow_usage_e qos_flow_usage ,
OpenAPI_sm_policy_association_release_cause_e rel_cause ,
2020-12-11 19:03:20 +00:00
char * supp_feat ,
2021-07-07 08:32:55 +00:00
OpenAPI_bridge_management_container_t * tsn_bridge_man_cont ,
2020-12-11 19:03:20 +00:00
OpenAPI_port_management_container_t * tsn_port_man_cont_dstt ,
2021-07-07 08:32:55 +00:00
OpenAPI_list_t * tsn_port_man_cont_nwtts ,
2021-07-16 08:02:33 +00:00
bool is_red_sess_indication ,
2021-07-07 08:32:55 +00:00
int red_sess_indication
)
2020-12-11 19:03:20 +00:00
{
2022-01-03 23:29:18 +00:00
OpenAPI_sm_policy_decision_t * sm_policy_decision_local_var = ogs_malloc ( sizeof ( OpenAPI_sm_policy_decision_t ) ) ;
ogs_assert ( sm_policy_decision_local_var ) ;
2020-12-11 19:03:20 +00:00
sm_policy_decision_local_var - > sess_rules = sess_rules ;
2023-10-05 11:39:14 +00:00
sm_policy_decision_local_var - > is_pcc_rules_null = is_pcc_rules_null ;
2020-12-11 19:03:20 +00:00
sm_policy_decision_local_var - > pcc_rules = pcc_rules ;
2021-07-16 08:02:33 +00:00
sm_policy_decision_local_var - > is_pcscf_rest_indication = is_pcscf_rest_indication ;
2020-12-11 19:03:20 +00:00
sm_policy_decision_local_var - > pcscf_rest_indication = pcscf_rest_indication ;
sm_policy_decision_local_var - > qos_decs = qos_decs ;
2023-10-05 11:39:14 +00:00
sm_policy_decision_local_var - > is_chg_decs_null = is_chg_decs_null ;
2020-12-11 19:03:20 +00:00
sm_policy_decision_local_var - > chg_decs = chg_decs ;
sm_policy_decision_local_var - > charging_info = charging_info ;
sm_policy_decision_local_var - > traff_cont_decs = traff_cont_decs ;
2023-10-05 11:39:14 +00:00
sm_policy_decision_local_var - > is_um_decs_null = is_um_decs_null ;
2020-12-11 19:03:20 +00:00
sm_policy_decision_local_var - > um_decs = um_decs ;
sm_policy_decision_local_var - > qos_chars = qos_chars ;
2023-10-05 11:39:14 +00:00
sm_policy_decision_local_var - > is_qos_mon_decs_null = is_qos_mon_decs_null ;
2020-12-11 19:03:20 +00:00
sm_policy_decision_local_var - > qos_mon_decs = qos_mon_decs ;
2021-07-16 08:02:33 +00:00
sm_policy_decision_local_var - > is_reflective_qo_s_timer = is_reflective_qo_s_timer ;
2020-12-11 19:03:20 +00:00
sm_policy_decision_local_var - > reflective_qo_s_timer = reflective_qo_s_timer ;
2023-10-05 11:39:14 +00:00
sm_policy_decision_local_var - > is_conds_null = is_conds_null ;
2020-12-11 19:03:20 +00:00
sm_policy_decision_local_var - > conds = conds ;
sm_policy_decision_local_var - > revalidation_time = revalidation_time ;
2021-07-16 08:02:33 +00:00
sm_policy_decision_local_var - > is_offline = is_offline ;
2020-12-11 19:03:20 +00:00
sm_policy_decision_local_var - > offline = offline ;
2021-07-16 08:02:33 +00:00
sm_policy_decision_local_var - > is_online = is_online ;
2020-12-11 19:03:20 +00:00
sm_policy_decision_local_var - > online = online ;
2023-03-01 10:56:49 +00:00
sm_policy_decision_local_var - > is_offline_ch_only = is_offline_ch_only ;
sm_policy_decision_local_var - > offline_ch_only = offline_ch_only ;
2023-10-05 11:39:14 +00:00
sm_policy_decision_local_var - > is_policy_ctrl_req_triggers_null = is_policy_ctrl_req_triggers_null ;
2020-12-11 19:03:20 +00:00
sm_policy_decision_local_var - > policy_ctrl_req_triggers = policy_ctrl_req_triggers ;
sm_policy_decision_local_var - > last_req_rule_data = last_req_rule_data ;
sm_policy_decision_local_var - > last_req_usage_data = last_req_usage_data ;
2023-10-05 11:39:14 +00:00
sm_policy_decision_local_var - > is_pra_infos_null = is_pra_infos_null ;
2020-12-11 19:03:20 +00:00
sm_policy_decision_local_var - > pra_infos = pra_infos ;
2021-07-16 08:02:33 +00:00
sm_policy_decision_local_var - > is_ipv4_index = is_ipv4_index ;
2020-12-11 19:03:20 +00:00
sm_policy_decision_local_var - > ipv4_index = ipv4_index ;
2021-07-16 08:02:33 +00:00
sm_policy_decision_local_var - > is_ipv6_index = is_ipv6_index ;
2020-12-11 19:03:20 +00:00
sm_policy_decision_local_var - > ipv6_index = ipv6_index ;
sm_policy_decision_local_var - > qos_flow_usage = qos_flow_usage ;
sm_policy_decision_local_var - > rel_cause = rel_cause ;
sm_policy_decision_local_var - > supp_feat = supp_feat ;
2021-07-07 08:32:55 +00:00
sm_policy_decision_local_var - > tsn_bridge_man_cont = tsn_bridge_man_cont ;
2020-12-11 19:03:20 +00:00
sm_policy_decision_local_var - > tsn_port_man_cont_dstt = tsn_port_man_cont_dstt ;
sm_policy_decision_local_var - > tsn_port_man_cont_nwtts = tsn_port_man_cont_nwtts ;
2021-07-16 08:02:33 +00:00
sm_policy_decision_local_var - > is_red_sess_indication = is_red_sess_indication ;
2021-07-07 08:32:55 +00:00
sm_policy_decision_local_var - > red_sess_indication = red_sess_indication ;
2020-12-11 19:03:20 +00:00
return sm_policy_decision_local_var ;
}
void OpenAPI_sm_policy_decision_free ( OpenAPI_sm_policy_decision_t * sm_policy_decision )
{
2023-03-01 08:50:25 +00:00
OpenAPI_lnode_t * node = NULL ;
2020-12-11 19:03:20 +00:00
if ( NULL = = sm_policy_decision ) {
return ;
}
2023-03-01 08:50:25 +00:00
if ( sm_policy_decision - > sess_rules ) {
OpenAPI_list_for_each ( sm_policy_decision - > sess_rules , node ) {
OpenAPI_map_t * localKeyValue = ( OpenAPI_map_t * ) node - > data ;
ogs_free ( localKeyValue - > key ) ;
OpenAPI_session_rule_free ( localKeyValue - > value ) ;
OpenAPI_map_free ( localKeyValue ) ;
}
OpenAPI_list_free ( sm_policy_decision - > sess_rules ) ;
sm_policy_decision - > sess_rules = NULL ;
}
if ( sm_policy_decision - > pcc_rules ) {
OpenAPI_list_for_each ( sm_policy_decision - > pcc_rules , node ) {
OpenAPI_map_t * localKeyValue = ( OpenAPI_map_t * ) node - > data ;
ogs_free ( localKeyValue - > key ) ;
OpenAPI_pcc_rule_free ( localKeyValue - > value ) ;
OpenAPI_map_free ( localKeyValue ) ;
}
OpenAPI_list_free ( sm_policy_decision - > pcc_rules ) ;
sm_policy_decision - > pcc_rules = NULL ;
}
if ( sm_policy_decision - > qos_decs ) {
OpenAPI_list_for_each ( sm_policy_decision - > qos_decs , node ) {
OpenAPI_map_t * localKeyValue = ( OpenAPI_map_t * ) node - > data ;
ogs_free ( localKeyValue - > key ) ;
OpenAPI_qos_data_free ( localKeyValue - > value ) ;
OpenAPI_map_free ( localKeyValue ) ;
}
OpenAPI_list_free ( sm_policy_decision - > qos_decs ) ;
sm_policy_decision - > qos_decs = NULL ;
}
if ( sm_policy_decision - > chg_decs ) {
OpenAPI_list_for_each ( sm_policy_decision - > chg_decs , node ) {
OpenAPI_map_t * localKeyValue = ( OpenAPI_map_t * ) node - > data ;
ogs_free ( localKeyValue - > key ) ;
OpenAPI_charging_data_free ( localKeyValue - > value ) ;
OpenAPI_map_free ( localKeyValue ) ;
}
OpenAPI_list_free ( sm_policy_decision - > chg_decs ) ;
sm_policy_decision - > chg_decs = NULL ;
}
if ( sm_policy_decision - > charging_info ) {
OpenAPI_charging_information_free ( sm_policy_decision - > charging_info ) ;
sm_policy_decision - > charging_info = NULL ;
}
if ( sm_policy_decision - > traff_cont_decs ) {
OpenAPI_list_for_each ( sm_policy_decision - > traff_cont_decs , node ) {
OpenAPI_map_t * localKeyValue = ( OpenAPI_map_t * ) node - > data ;
ogs_free ( localKeyValue - > key ) ;
OpenAPI_traffic_control_data_free ( localKeyValue - > value ) ;
OpenAPI_map_free ( localKeyValue ) ;
}
OpenAPI_list_free ( sm_policy_decision - > traff_cont_decs ) ;
sm_policy_decision - > traff_cont_decs = NULL ;
}
if ( sm_policy_decision - > um_decs ) {
OpenAPI_list_for_each ( sm_policy_decision - > um_decs , node ) {
OpenAPI_map_t * localKeyValue = ( OpenAPI_map_t * ) node - > data ;
ogs_free ( localKeyValue - > key ) ;
OpenAPI_usage_monitoring_data_free ( localKeyValue - > value ) ;
OpenAPI_map_free ( localKeyValue ) ;
}
OpenAPI_list_free ( sm_policy_decision - > um_decs ) ;
sm_policy_decision - > um_decs = NULL ;
}
if ( sm_policy_decision - > qos_chars ) {
OpenAPI_list_for_each ( sm_policy_decision - > qos_chars , node ) {
OpenAPI_map_t * localKeyValue = ( OpenAPI_map_t * ) node - > data ;
ogs_free ( localKeyValue - > key ) ;
OpenAPI_qos_characteristics_free ( localKeyValue - > value ) ;
OpenAPI_map_free ( localKeyValue ) ;
}
OpenAPI_list_free ( sm_policy_decision - > qos_chars ) ;
sm_policy_decision - > qos_chars = NULL ;
}
if ( sm_policy_decision - > qos_mon_decs ) {
OpenAPI_list_for_each ( sm_policy_decision - > qos_mon_decs , node ) {
OpenAPI_map_t * localKeyValue = ( OpenAPI_map_t * ) node - > data ;
ogs_free ( localKeyValue - > key ) ;
OpenAPI_qos_monitoring_data_free ( localKeyValue - > value ) ;
OpenAPI_map_free ( localKeyValue ) ;
}
OpenAPI_list_free ( sm_policy_decision - > qos_mon_decs ) ;
sm_policy_decision - > qos_mon_decs = NULL ;
}
if ( sm_policy_decision - > conds ) {
OpenAPI_list_for_each ( sm_policy_decision - > conds , node ) {
OpenAPI_map_t * localKeyValue = ( OpenAPI_map_t * ) node - > data ;
ogs_free ( localKeyValue - > key ) ;
OpenAPI_condition_data_free ( localKeyValue - > value ) ;
OpenAPI_map_free ( localKeyValue ) ;
}
OpenAPI_list_free ( sm_policy_decision - > conds ) ;
sm_policy_decision - > conds = NULL ;
}
if ( sm_policy_decision - > revalidation_time ) {
ogs_free ( sm_policy_decision - > revalidation_time ) ;
sm_policy_decision - > revalidation_time = NULL ;
}
if ( sm_policy_decision - > policy_ctrl_req_triggers ) {
OpenAPI_list_free ( sm_policy_decision - > policy_ctrl_req_triggers ) ;
sm_policy_decision - > policy_ctrl_req_triggers = NULL ;
}
if ( sm_policy_decision - > last_req_rule_data ) {
OpenAPI_list_for_each ( sm_policy_decision - > last_req_rule_data , node ) {
OpenAPI_requested_rule_data_free ( node - > data ) ;
}
OpenAPI_list_free ( sm_policy_decision - > last_req_rule_data ) ;
sm_policy_decision - > last_req_rule_data = NULL ;
}
if ( sm_policy_decision - > last_req_usage_data ) {
OpenAPI_requested_usage_data_free ( sm_policy_decision - > last_req_usage_data ) ;
sm_policy_decision - > last_req_usage_data = NULL ;
}
if ( sm_policy_decision - > pra_infos ) {
OpenAPI_list_for_each ( sm_policy_decision - > pra_infos , node ) {
OpenAPI_map_t * localKeyValue = ( OpenAPI_map_t * ) node - > data ;
ogs_free ( localKeyValue - > key ) ;
OpenAPI_presence_info_rm_free ( localKeyValue - > value ) ;
OpenAPI_map_free ( localKeyValue ) ;
}
OpenAPI_list_free ( sm_policy_decision - > pra_infos ) ;
sm_policy_decision - > pra_infos = NULL ;
}
if ( sm_policy_decision - > supp_feat ) {
ogs_free ( sm_policy_decision - > supp_feat ) ;
sm_policy_decision - > supp_feat = NULL ;
}
if ( sm_policy_decision - > tsn_bridge_man_cont ) {
OpenAPI_bridge_management_container_free ( sm_policy_decision - > tsn_bridge_man_cont ) ;
sm_policy_decision - > tsn_bridge_man_cont = NULL ;
}
if ( sm_policy_decision - > tsn_port_man_cont_dstt ) {
OpenAPI_port_management_container_free ( sm_policy_decision - > tsn_port_man_cont_dstt ) ;
sm_policy_decision - > tsn_port_man_cont_dstt = NULL ;
}
if ( sm_policy_decision - > tsn_port_man_cont_nwtts ) {
OpenAPI_list_for_each ( sm_policy_decision - > tsn_port_man_cont_nwtts , node ) {
OpenAPI_port_management_container_free ( node - > data ) ;
}
OpenAPI_list_free ( sm_policy_decision - > tsn_port_man_cont_nwtts ) ;
sm_policy_decision - > tsn_port_man_cont_nwtts = NULL ;
2020-12-11 19:03:20 +00:00
}
ogs_free ( sm_policy_decision ) ;
}
cJSON * OpenAPI_sm_policy_decision_convertToJSON ( OpenAPI_sm_policy_decision_t * sm_policy_decision )
{
cJSON * item = NULL ;
2023-03-01 08:50:25 +00:00
OpenAPI_lnode_t * node = NULL ;
2020-12-11 19:03:20 +00:00
if ( sm_policy_decision = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [SmPolicyDecision] " ) ;
return NULL ;
}
item = cJSON_CreateObject ( ) ;
if ( sm_policy_decision - > sess_rules ) {
2021-07-07 08:32:55 +00:00
cJSON * sess_rules = cJSON_AddObjectToObject ( item , " sessRules " ) ;
if ( sess_rules = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [sess_rules] " ) ;
goto end ;
}
cJSON * localMapObject = sess_rules ;
if ( sm_policy_decision - > sess_rules ) {
2023-03-01 08:50:25 +00:00
OpenAPI_list_for_each ( sm_policy_decision - > sess_rules , node ) {
OpenAPI_map_t * localKeyValue = ( OpenAPI_map_t * ) node - > data ;
2023-05-13 22:00:22 +00:00
if ( localKeyValue = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [sess_rules] " ) ;
goto end ;
}
if ( localKeyValue - > key = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [sess_rules] " ) ;
goto end ;
}
2023-03-01 08:50:25 +00:00
cJSON * itemLocal = localKeyValue - > value ?
OpenAPI_session_rule_convertToJSON ( localKeyValue - > value ) :
cJSON_CreateNull ( ) ;
if ( itemLocal = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [inner] " ) ;
goto end ;
2020-12-11 19:03:20 +00:00
}
2023-03-01 08:50:25 +00:00
cJSON_AddItemToObject ( localMapObject , localKeyValue - > key , itemLocal ) ;
2020-12-11 19:03:20 +00:00
}
}
2023-03-01 08:50:25 +00:00
}
2020-12-11 19:03:20 +00:00
if ( sm_policy_decision - > pcc_rules ) {
2021-07-07 08:32:55 +00:00
cJSON * pcc_rules = cJSON_AddObjectToObject ( item , " pccRules " ) ;
if ( pcc_rules = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [pcc_rules] " ) ;
goto end ;
}
cJSON * localMapObject = pcc_rules ;
if ( sm_policy_decision - > pcc_rules ) {
2023-03-01 08:50:25 +00:00
OpenAPI_list_for_each ( sm_policy_decision - > pcc_rules , node ) {
OpenAPI_map_t * localKeyValue = ( OpenAPI_map_t * ) node - > data ;
2023-05-13 22:00:22 +00:00
if ( localKeyValue = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [pcc_rules] " ) ;
goto end ;
}
if ( localKeyValue - > key = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [pcc_rules] " ) ;
goto end ;
}
2023-03-01 08:50:25 +00:00
cJSON * itemLocal = localKeyValue - > value ?
OpenAPI_pcc_rule_convertToJSON ( localKeyValue - > value ) :
cJSON_CreateNull ( ) ;
if ( itemLocal = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [inner] " ) ;
goto end ;
2020-12-11 19:03:20 +00:00
}
2023-03-01 08:50:25 +00:00
cJSON_AddItemToObject ( localMapObject , localKeyValue - > key , itemLocal ) ;
2020-12-11 19:03:20 +00:00
}
}
2023-10-05 11:39:14 +00:00
} else if ( sm_policy_decision - > is_pcc_rules_null ) {
if ( cJSON_AddNullToObject ( item , " pccRules " ) = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [pcc_rules] " ) ;
goto end ;
}
2023-03-01 08:50:25 +00:00
}
2020-12-11 19:03:20 +00:00
2021-07-16 08:02:33 +00:00
if ( sm_policy_decision - > is_pcscf_rest_indication ) {
2021-07-07 08:32:55 +00:00
if ( cJSON_AddBoolToObject ( item , " pcscfRestIndication " , sm_policy_decision - > pcscf_rest_indication ) = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [pcscf_rest_indication] " ) ;
goto end ;
}
2020-12-11 19:03:20 +00:00
}
if ( sm_policy_decision - > qos_decs ) {
2021-07-07 08:32:55 +00:00
cJSON * qos_decs = cJSON_AddObjectToObject ( item , " qosDecs " ) ;
if ( qos_decs = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [qos_decs] " ) ;
goto end ;
}
cJSON * localMapObject = qos_decs ;
if ( sm_policy_decision - > qos_decs ) {
2023-03-01 08:50:25 +00:00
OpenAPI_list_for_each ( sm_policy_decision - > qos_decs , node ) {
OpenAPI_map_t * localKeyValue = ( OpenAPI_map_t * ) node - > data ;
2023-05-13 22:00:22 +00:00
if ( localKeyValue = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [qos_decs] " ) ;
goto end ;
}
if ( localKeyValue - > key = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [qos_decs] " ) ;
goto end ;
}
2023-03-01 08:50:25 +00:00
cJSON * itemLocal = localKeyValue - > value ?
OpenAPI_qos_data_convertToJSON ( localKeyValue - > value ) :
cJSON_CreateNull ( ) ;
if ( itemLocal = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [inner] " ) ;
goto end ;
2020-12-11 19:03:20 +00:00
}
2023-03-01 08:50:25 +00:00
cJSON_AddItemToObject ( localMapObject , localKeyValue - > key , itemLocal ) ;
2020-12-11 19:03:20 +00:00
}
}
2023-03-01 08:50:25 +00:00
}
2020-12-11 19:03:20 +00:00
if ( sm_policy_decision - > chg_decs ) {
2021-07-07 08:32:55 +00:00
cJSON * chg_decs = cJSON_AddObjectToObject ( item , " chgDecs " ) ;
if ( chg_decs = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [chg_decs] " ) ;
goto end ;
}
cJSON * localMapObject = chg_decs ;
if ( sm_policy_decision - > chg_decs ) {
2023-03-01 08:50:25 +00:00
OpenAPI_list_for_each ( sm_policy_decision - > chg_decs , node ) {
OpenAPI_map_t * localKeyValue = ( OpenAPI_map_t * ) node - > data ;
2023-05-13 22:00:22 +00:00
if ( localKeyValue = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [chg_decs] " ) ;
goto end ;
}
if ( localKeyValue - > key = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [chg_decs] " ) ;
goto end ;
}
2023-03-01 08:50:25 +00:00
cJSON * itemLocal = localKeyValue - > value ?
OpenAPI_charging_data_convertToJSON ( localKeyValue - > value ) :
cJSON_CreateNull ( ) ;
if ( itemLocal = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [inner] " ) ;
goto end ;
2020-12-11 19:03:20 +00:00
}
2023-03-01 08:50:25 +00:00
cJSON_AddItemToObject ( localMapObject , localKeyValue - > key , itemLocal ) ;
2020-12-11 19:03:20 +00:00
}
}
2023-10-05 11:39:14 +00:00
} else if ( sm_policy_decision - > is_chg_decs_null ) {
if ( cJSON_AddNullToObject ( item , " chgDecs " ) = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [chg_decs] " ) ;
goto end ;
}
2023-03-01 08:50:25 +00:00
}
2020-12-11 19:03:20 +00:00
if ( sm_policy_decision - > charging_info ) {
2021-07-07 08:32:55 +00:00
cJSON * charging_info_local_JSON = OpenAPI_charging_information_convertToJSON ( sm_policy_decision - > charging_info ) ;
if ( charging_info_local_JSON = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [charging_info] " ) ;
goto end ;
}
cJSON_AddItemToObject ( item , " chargingInfo " , charging_info_local_JSON ) ;
if ( item - > child = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [charging_info] " ) ;
goto end ;
}
2020-12-11 19:03:20 +00:00
}
if ( sm_policy_decision - > traff_cont_decs ) {
2021-07-07 08:32:55 +00:00
cJSON * traff_cont_decs = cJSON_AddObjectToObject ( item , " traffContDecs " ) ;
if ( traff_cont_decs = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [traff_cont_decs] " ) ;
goto end ;
}
cJSON * localMapObject = traff_cont_decs ;
if ( sm_policy_decision - > traff_cont_decs ) {
2023-03-01 08:50:25 +00:00
OpenAPI_list_for_each ( sm_policy_decision - > traff_cont_decs , node ) {
OpenAPI_map_t * localKeyValue = ( OpenAPI_map_t * ) node - > data ;
2023-05-13 22:00:22 +00:00
if ( localKeyValue = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [traff_cont_decs] " ) ;
goto end ;
}
if ( localKeyValue - > key = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [traff_cont_decs] " ) ;
goto end ;
}
2023-03-01 08:50:25 +00:00
cJSON * itemLocal = localKeyValue - > value ?
OpenAPI_traffic_control_data_convertToJSON ( localKeyValue - > value ) :
cJSON_CreateNull ( ) ;
if ( itemLocal = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [inner] " ) ;
goto end ;
2020-12-11 19:03:20 +00:00
}
2023-03-01 08:50:25 +00:00
cJSON_AddItemToObject ( localMapObject , localKeyValue - > key , itemLocal ) ;
2020-12-11 19:03:20 +00:00
}
}
2023-03-01 08:50:25 +00:00
}
2020-12-11 19:03:20 +00:00
if ( sm_policy_decision - > um_decs ) {
2021-07-07 08:32:55 +00:00
cJSON * um_decs = cJSON_AddObjectToObject ( item , " umDecs " ) ;
if ( um_decs = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [um_decs] " ) ;
goto end ;
}
cJSON * localMapObject = um_decs ;
if ( sm_policy_decision - > um_decs ) {
2023-03-01 08:50:25 +00:00
OpenAPI_list_for_each ( sm_policy_decision - > um_decs , node ) {
OpenAPI_map_t * localKeyValue = ( OpenAPI_map_t * ) node - > data ;
2023-05-13 22:00:22 +00:00
if ( localKeyValue = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [um_decs] " ) ;
goto end ;
}
if ( localKeyValue - > key = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [um_decs] " ) ;
goto end ;
}
2023-03-01 08:50:25 +00:00
cJSON * itemLocal = localKeyValue - > value ?
OpenAPI_usage_monitoring_data_convertToJSON ( localKeyValue - > value ) :
cJSON_CreateNull ( ) ;
if ( itemLocal = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [inner] " ) ;
goto end ;
2020-12-11 19:03:20 +00:00
}
2023-03-01 08:50:25 +00:00
cJSON_AddItemToObject ( localMapObject , localKeyValue - > key , itemLocal ) ;
2020-12-11 19:03:20 +00:00
}
}
2023-10-05 11:39:14 +00:00
} else if ( sm_policy_decision - > is_um_decs_null ) {
if ( cJSON_AddNullToObject ( item , " umDecs " ) = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [um_decs] " ) ;
goto end ;
}
2023-03-01 08:50:25 +00:00
}
2020-12-11 19:03:20 +00:00
if ( sm_policy_decision - > qos_chars ) {
2021-07-07 08:32:55 +00:00
cJSON * qos_chars = cJSON_AddObjectToObject ( item , " qosChars " ) ;
if ( qos_chars = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [qos_chars] " ) ;
goto end ;
}
cJSON * localMapObject = qos_chars ;
if ( sm_policy_decision - > qos_chars ) {
2023-03-01 08:50:25 +00:00
OpenAPI_list_for_each ( sm_policy_decision - > qos_chars , node ) {
OpenAPI_map_t * localKeyValue = ( OpenAPI_map_t * ) node - > data ;
2023-05-13 22:00:22 +00:00
if ( localKeyValue = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [qos_chars] " ) ;
goto end ;
}
if ( localKeyValue - > key = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [qos_chars] " ) ;
goto end ;
}
2023-03-01 08:50:25 +00:00
cJSON * itemLocal = localKeyValue - > value ?
OpenAPI_qos_characteristics_convertToJSON ( localKeyValue - > value ) :
cJSON_CreateNull ( ) ;
if ( itemLocal = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [inner] " ) ;
goto end ;
2020-12-11 19:03:20 +00:00
}
2023-03-01 08:50:25 +00:00
cJSON_AddItemToObject ( localMapObject , localKeyValue - > key , itemLocal ) ;
2020-12-11 19:03:20 +00:00
}
}
2023-03-01 08:50:25 +00:00
}
2020-12-11 19:03:20 +00:00
if ( sm_policy_decision - > qos_mon_decs ) {
2021-07-07 08:32:55 +00:00
cJSON * qos_mon_decs = cJSON_AddObjectToObject ( item , " qosMonDecs " ) ;
if ( qos_mon_decs = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [qos_mon_decs] " ) ;
goto end ;
}
cJSON * localMapObject = qos_mon_decs ;
if ( sm_policy_decision - > qos_mon_decs ) {
2023-03-01 08:50:25 +00:00
OpenAPI_list_for_each ( sm_policy_decision - > qos_mon_decs , node ) {
OpenAPI_map_t * localKeyValue = ( OpenAPI_map_t * ) node - > data ;
2023-05-13 22:00:22 +00:00
if ( localKeyValue = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [qos_mon_decs] " ) ;
goto end ;
}
if ( localKeyValue - > key = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [qos_mon_decs] " ) ;
goto end ;
}
2023-03-01 08:50:25 +00:00
cJSON * itemLocal = localKeyValue - > value ?
OpenAPI_qos_monitoring_data_convertToJSON ( localKeyValue - > value ) :
cJSON_CreateNull ( ) ;
if ( itemLocal = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [inner] " ) ;
goto end ;
2020-12-11 19:03:20 +00:00
}
2023-03-01 08:50:25 +00:00
cJSON_AddItemToObject ( localMapObject , localKeyValue - > key , itemLocal ) ;
2020-12-11 19:03:20 +00:00
}
}
2023-10-05 11:39:14 +00:00
} else if ( sm_policy_decision - > is_qos_mon_decs_null ) {
if ( cJSON_AddNullToObject ( item , " qosMonDecs " ) = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [qos_mon_decs] " ) ;
goto end ;
}
2023-03-01 08:50:25 +00:00
}
2020-12-11 19:03:20 +00:00
2021-07-16 08:02:33 +00:00
if ( sm_policy_decision - > is_reflective_qo_s_timer ) {
2021-07-07 08:32:55 +00:00
if ( cJSON_AddNumberToObject ( item , " reflectiveQoSTimer " , sm_policy_decision - > reflective_qo_s_timer ) = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [reflective_qo_s_timer] " ) ;
goto end ;
}
2020-12-11 19:03:20 +00:00
}
if ( sm_policy_decision - > conds ) {
2021-07-07 08:32:55 +00:00
cJSON * conds = cJSON_AddObjectToObject ( item , " conds " ) ;
if ( conds = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [conds] " ) ;
goto end ;
}
cJSON * localMapObject = conds ;
if ( sm_policy_decision - > conds ) {
2023-03-01 08:50:25 +00:00
OpenAPI_list_for_each ( sm_policy_decision - > conds , node ) {
OpenAPI_map_t * localKeyValue = ( OpenAPI_map_t * ) node - > data ;
2023-05-13 22:00:22 +00:00
if ( localKeyValue = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [conds] " ) ;
goto end ;
}
if ( localKeyValue - > key = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [conds] " ) ;
goto end ;
}
2023-03-01 08:50:25 +00:00
cJSON * itemLocal = localKeyValue - > value ?
OpenAPI_condition_data_convertToJSON ( localKeyValue - > value ) :
cJSON_CreateNull ( ) ;
if ( itemLocal = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [inner] " ) ;
goto end ;
2020-12-11 19:03:20 +00:00
}
2023-03-01 08:50:25 +00:00
cJSON_AddItemToObject ( localMapObject , localKeyValue - > key , itemLocal ) ;
2020-12-11 19:03:20 +00:00
}
}
2023-10-05 11:39:14 +00:00
} else if ( sm_policy_decision - > is_conds_null ) {
if ( cJSON_AddNullToObject ( item , " conds " ) = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [conds] " ) ;
goto end ;
}
2023-03-01 08:50:25 +00:00
}
2020-12-11 19:03:20 +00:00
if ( sm_policy_decision - > revalidation_time ) {
2021-07-07 08:32:55 +00:00
if ( cJSON_AddStringToObject ( item , " revalidationTime " , sm_policy_decision - > revalidation_time ) = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [revalidation_time] " ) ;
goto end ;
}
2020-12-11 19:03:20 +00:00
}
2021-07-16 08:02:33 +00:00
if ( sm_policy_decision - > is_offline ) {
2021-07-07 08:32:55 +00:00
if ( cJSON_AddBoolToObject ( item , " offline " , sm_policy_decision - > offline ) = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [offline] " ) ;
goto end ;
}
2020-12-11 19:03:20 +00:00
}
2021-07-16 08:02:33 +00:00
if ( sm_policy_decision - > is_online ) {
2021-07-07 08:32:55 +00:00
if ( cJSON_AddBoolToObject ( item , " online " , sm_policy_decision - > online ) = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [online] " ) ;
goto end ;
}
2020-12-11 19:03:20 +00:00
}
2023-03-01 10:56:49 +00:00
if ( sm_policy_decision - > is_offline_ch_only ) {
if ( cJSON_AddBoolToObject ( item , " offlineChOnly " , sm_policy_decision - > offline_ch_only ) = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [offline_ch_only] " ) ;
goto end ;
}
}
2023-03-01 08:50:25 +00:00
if ( sm_policy_decision - > policy_ctrl_req_triggers ! = OpenAPI_policy_control_request_trigger_NULL ) {
cJSON * policy_ctrl_req_triggersList = cJSON_AddArrayToObject ( item , " policyCtrlReqTriggers " ) ;
if ( policy_ctrl_req_triggersList = = NULL ) {
2021-07-07 08:32:55 +00:00
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [policy_ctrl_req_triggers] " ) ;
goto end ;
}
2023-03-01 08:50:25 +00:00
OpenAPI_list_for_each ( sm_policy_decision - > policy_ctrl_req_triggers , node ) {
if ( cJSON_AddStringToObject ( policy_ctrl_req_triggersList , " " , OpenAPI_policy_control_request_trigger_ToString ( ( intptr_t ) node - > data ) ) = = NULL ) {
2020-12-11 19:03:20 +00:00
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [policy_ctrl_req_triggers] " ) ;
goto end ;
}
2021-07-07 08:32:55 +00:00
}
2023-10-05 11:39:14 +00:00
} else if ( sm_policy_decision - > is_policy_ctrl_req_triggers_null ) {
if ( cJSON_AddNullToObject ( item , " policyCtrlReqTriggers " ) = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [policy_ctrl_req_triggers] " ) ;
goto end ;
}
2020-12-11 19:03:20 +00:00
}
if ( sm_policy_decision - > last_req_rule_data ) {
2021-07-07 08:32:55 +00:00
cJSON * last_req_rule_dataList = cJSON_AddArrayToObject ( item , " lastReqRuleData " ) ;
if ( last_req_rule_dataList = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [last_req_rule_data] " ) ;
goto end ;
}
2023-03-01 08:50:25 +00:00
OpenAPI_list_for_each ( sm_policy_decision - > last_req_rule_data , node ) {
cJSON * itemLocal = OpenAPI_requested_rule_data_convertToJSON ( node - > data ) ;
if ( itemLocal = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [last_req_rule_data] " ) ;
goto end ;
2020-12-11 19:03:20 +00:00
}
2023-03-01 08:50:25 +00:00
cJSON_AddItemToArray ( last_req_rule_dataList , itemLocal ) ;
2020-12-11 19:03:20 +00:00
}
2021-07-07 08:32:55 +00:00
}
2020-12-11 19:03:20 +00:00
if ( sm_policy_decision - > last_req_usage_data ) {
2021-07-07 08:32:55 +00:00
cJSON * last_req_usage_data_local_JSON = OpenAPI_requested_usage_data_convertToJSON ( sm_policy_decision - > last_req_usage_data ) ;
if ( last_req_usage_data_local_JSON = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [last_req_usage_data] " ) ;
goto end ;
}
cJSON_AddItemToObject ( item , " lastReqUsageData " , last_req_usage_data_local_JSON ) ;
if ( item - > child = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [last_req_usage_data] " ) ;
goto end ;
}
2020-12-11 19:03:20 +00:00
}
if ( sm_policy_decision - > pra_infos ) {
2021-07-07 08:32:55 +00:00
cJSON * pra_infos = cJSON_AddObjectToObject ( item , " praInfos " ) ;
if ( pra_infos = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [pra_infos] " ) ;
goto end ;
}
cJSON * localMapObject = pra_infos ;
if ( sm_policy_decision - > pra_infos ) {
2023-03-01 08:50:25 +00:00
OpenAPI_list_for_each ( sm_policy_decision - > pra_infos , node ) {
OpenAPI_map_t * localKeyValue = ( OpenAPI_map_t * ) node - > data ;
2023-05-13 22:00:22 +00:00
if ( localKeyValue = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [pra_infos] " ) ;
goto end ;
}
if ( localKeyValue - > key = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [pra_infos] " ) ;
goto end ;
}
2023-03-01 08:50:25 +00:00
cJSON * itemLocal = localKeyValue - > value ?
OpenAPI_presence_info_rm_convertToJSON ( localKeyValue - > value ) :
cJSON_CreateNull ( ) ;
if ( itemLocal = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [inner] " ) ;
goto end ;
2020-12-11 19:03:20 +00:00
}
2023-03-01 08:50:25 +00:00
cJSON_AddItemToObject ( localMapObject , localKeyValue - > key , itemLocal ) ;
2020-12-11 19:03:20 +00:00
}
}
2023-10-05 11:39:14 +00:00
} else if ( sm_policy_decision - > is_pra_infos_null ) {
if ( cJSON_AddNullToObject ( item , " praInfos " ) = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [pra_infos] " ) ;
goto end ;
}
2023-03-01 08:50:25 +00:00
}
2020-12-11 19:03:20 +00:00
2021-07-16 08:02:33 +00:00
if ( sm_policy_decision - > is_ipv4_index ) {
2021-07-07 08:32:55 +00:00
if ( cJSON_AddNumberToObject ( item , " ipv4Index " , sm_policy_decision - > ipv4_index ) = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [ipv4_index] " ) ;
goto end ;
}
2020-12-11 19:03:20 +00:00
}
2021-07-16 08:02:33 +00:00
if ( sm_policy_decision - > is_ipv6_index ) {
2021-07-07 08:32:55 +00:00
if ( cJSON_AddNumberToObject ( item , " ipv6Index " , sm_policy_decision - > ipv6_index ) = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [ipv6_index] " ) ;
goto end ;
}
2020-12-11 19:03:20 +00:00
}
2023-03-01 08:50:25 +00:00
if ( sm_policy_decision - > qos_flow_usage ! = OpenAPI_qos_flow_usage_NULL ) {
2021-07-07 08:32:55 +00:00
if ( cJSON_AddStringToObject ( item , " qosFlowUsage " , OpenAPI_qos_flow_usage_ToString ( sm_policy_decision - > qos_flow_usage ) ) = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [qos_flow_usage] " ) ;
goto end ;
}
2020-12-11 19:03:20 +00:00
}
2023-03-01 08:50:25 +00:00
if ( sm_policy_decision - > rel_cause ! = OpenAPI_sm_policy_association_release_cause_NULL ) {
2021-07-07 08:32:55 +00:00
if ( cJSON_AddStringToObject ( item , " relCause " , OpenAPI_sm_policy_association_release_cause_ToString ( sm_policy_decision - > rel_cause ) ) = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [rel_cause] " ) ;
goto end ;
}
2020-12-11 19:03:20 +00:00
}
if ( sm_policy_decision - > supp_feat ) {
2021-07-07 08:32:55 +00:00
if ( cJSON_AddStringToObject ( item , " suppFeat " , sm_policy_decision - > supp_feat ) = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [supp_feat] " ) ;
goto end ;
}
}
if ( sm_policy_decision - > tsn_bridge_man_cont ) {
cJSON * tsn_bridge_man_cont_local_JSON = OpenAPI_bridge_management_container_convertToJSON ( sm_policy_decision - > tsn_bridge_man_cont ) ;
if ( tsn_bridge_man_cont_local_JSON = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [tsn_bridge_man_cont] " ) ;
goto end ;
}
cJSON_AddItemToObject ( item , " tsnBridgeManCont " , tsn_bridge_man_cont_local_JSON ) ;
if ( item - > child = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [tsn_bridge_man_cont] " ) ;
goto end ;
}
2020-12-11 19:03:20 +00:00
}
if ( sm_policy_decision - > tsn_port_man_cont_dstt ) {
2021-07-07 08:32:55 +00:00
cJSON * tsn_port_man_cont_dstt_local_JSON = OpenAPI_port_management_container_convertToJSON ( sm_policy_decision - > tsn_port_man_cont_dstt ) ;
if ( tsn_port_man_cont_dstt_local_JSON = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [tsn_port_man_cont_dstt] " ) ;
goto end ;
}
cJSON_AddItemToObject ( item , " tsnPortManContDstt " , tsn_port_man_cont_dstt_local_JSON ) ;
if ( item - > child = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [tsn_port_man_cont_dstt] " ) ;
goto end ;
}
2020-12-11 19:03:20 +00:00
}
if ( sm_policy_decision - > tsn_port_man_cont_nwtts ) {
2021-07-07 08:32:55 +00:00
cJSON * tsn_port_man_cont_nwttsList = cJSON_AddArrayToObject ( item , " tsnPortManContNwtts " ) ;
if ( tsn_port_man_cont_nwttsList = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [tsn_port_man_cont_nwtts] " ) ;
goto end ;
}
2023-03-01 08:50:25 +00:00
OpenAPI_list_for_each ( sm_policy_decision - > tsn_port_man_cont_nwtts , node ) {
cJSON * itemLocal = OpenAPI_port_management_container_convertToJSON ( node - > data ) ;
if ( itemLocal = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [tsn_port_man_cont_nwtts] " ) ;
goto end ;
2020-12-11 19:03:20 +00:00
}
2023-03-01 08:50:25 +00:00
cJSON_AddItemToArray ( tsn_port_man_cont_nwttsList , itemLocal ) ;
2020-12-11 19:03:20 +00:00
}
2021-07-07 08:32:55 +00:00
}
2021-07-16 08:02:33 +00:00
if ( sm_policy_decision - > is_red_sess_indication ) {
2021-07-07 08:32:55 +00:00
if ( cJSON_AddBoolToObject ( item , " redSessIndication " , sm_policy_decision - > red_sess_indication ) = = NULL ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed [red_sess_indication] " ) ;
goto end ;
}
}
2020-12-11 19:03:20 +00:00
end :
return item ;
}
OpenAPI_sm_policy_decision_t * OpenAPI_sm_policy_decision_parseFromJSON ( cJSON * sm_policy_decisionJSON )
{
OpenAPI_sm_policy_decision_t * sm_policy_decision_local_var = NULL ;
2023-03-01 08:50:25 +00:00
OpenAPI_lnode_t * node = NULL ;
cJSON * sess_rules = NULL ;
OpenAPI_list_t * sess_rulesList = NULL ;
cJSON * pcc_rules = NULL ;
OpenAPI_list_t * pcc_rulesList = NULL ;
cJSON * pcscf_rest_indication = NULL ;
cJSON * qos_decs = NULL ;
OpenAPI_list_t * qos_decsList = NULL ;
cJSON * chg_decs = NULL ;
OpenAPI_list_t * chg_decsList = NULL ;
cJSON * charging_info = NULL ;
OpenAPI_charging_information_t * charging_info_local_nonprim = NULL ;
cJSON * traff_cont_decs = NULL ;
OpenAPI_list_t * traff_cont_decsList = NULL ;
cJSON * um_decs = NULL ;
OpenAPI_list_t * um_decsList = NULL ;
cJSON * qos_chars = NULL ;
OpenAPI_list_t * qos_charsList = NULL ;
cJSON * qos_mon_decs = NULL ;
OpenAPI_list_t * qos_mon_decsList = NULL ;
cJSON * reflective_qo_s_timer = NULL ;
cJSON * conds = NULL ;
OpenAPI_list_t * condsList = NULL ;
cJSON * revalidation_time = NULL ;
cJSON * offline = NULL ;
cJSON * online = NULL ;
2023-03-01 10:56:49 +00:00
cJSON * offline_ch_only = NULL ;
2023-03-01 08:50:25 +00:00
cJSON * policy_ctrl_req_triggers = NULL ;
OpenAPI_list_t * policy_ctrl_req_triggersList = NULL ;
cJSON * last_req_rule_data = NULL ;
OpenAPI_list_t * last_req_rule_dataList = NULL ;
cJSON * last_req_usage_data = NULL ;
OpenAPI_requested_usage_data_t * last_req_usage_data_local_nonprim = NULL ;
cJSON * pra_infos = NULL ;
OpenAPI_list_t * pra_infosList = NULL ;
cJSON * ipv4_index = NULL ;
cJSON * ipv6_index = NULL ;
cJSON * qos_flow_usage = NULL ;
OpenAPI_qos_flow_usage_e qos_flow_usageVariable = 0 ;
cJSON * rel_cause = NULL ;
OpenAPI_sm_policy_association_release_cause_e rel_causeVariable = 0 ;
cJSON * supp_feat = NULL ;
cJSON * tsn_bridge_man_cont = NULL ;
OpenAPI_bridge_management_container_t * tsn_bridge_man_cont_local_nonprim = NULL ;
cJSON * tsn_port_man_cont_dstt = NULL ;
OpenAPI_port_management_container_t * tsn_port_man_cont_dstt_local_nonprim = NULL ;
cJSON * tsn_port_man_cont_nwtts = NULL ;
OpenAPI_list_t * tsn_port_man_cont_nwttsList = NULL ;
cJSON * red_sess_indication = NULL ;
sess_rules = cJSON_GetObjectItemCaseSensitive ( sm_policy_decisionJSON , " sessRules " ) ;
2021-07-16 08:02:33 +00:00
if ( sess_rules ) {
2023-03-01 08:50:25 +00:00
cJSON * sess_rules_local_map = NULL ;
if ( ! cJSON_IsObject ( sess_rules ) & & ! cJSON_IsNull ( sess_rules ) ) {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [sess_rules] " ) ;
2020-12-11 19:03:20 +00:00
goto end ;
}
2023-03-01 08:50:25 +00:00
if ( cJSON_IsObject ( sess_rules ) ) {
sess_rulesList = OpenAPI_list_create ( ) ;
OpenAPI_map_t * localMapKeyPair = NULL ;
cJSON_ArrayForEach ( sess_rules_local_map , sess_rules ) {
cJSON * localMapObject = sess_rules_local_map ;
if ( cJSON_IsObject ( localMapObject ) ) {
localMapKeyPair = OpenAPI_map_create (
ogs_strdup ( localMapObject - > string ) , OpenAPI_session_rule_parseFromJSON ( localMapObject ) ) ;
} else if ( cJSON_IsNull ( localMapObject ) ) {
localMapKeyPair = OpenAPI_map_create ( ogs_strdup ( localMapObject - > string ) , NULL ) ;
} else {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [inner] " ) ;
goto end ;
}
OpenAPI_list_add ( sess_rulesList , localMapKeyPair ) ;
}
}
2021-07-08 06:00:59 +00:00
}
2020-12-11 19:03:20 +00:00
2023-03-01 08:50:25 +00:00
pcc_rules = cJSON_GetObjectItemCaseSensitive ( sm_policy_decisionJSON , " pccRules " ) ;
2021-07-16 08:02:33 +00:00
if ( pcc_rules ) {
2023-10-05 11:39:14 +00:00
if ( ! cJSON_IsNull ( pcc_rules ) ) {
2023-03-01 08:50:25 +00:00
cJSON * pcc_rules_local_map = NULL ;
if ( ! cJSON_IsObject ( pcc_rules ) & & ! cJSON_IsNull ( pcc_rules ) ) {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [pcc_rules] " ) ;
2020-12-11 19:03:20 +00:00
goto end ;
}
2023-03-01 08:50:25 +00:00
if ( cJSON_IsObject ( pcc_rules ) ) {
pcc_rulesList = OpenAPI_list_create ( ) ;
OpenAPI_map_t * localMapKeyPair = NULL ;
cJSON_ArrayForEach ( pcc_rules_local_map , pcc_rules ) {
cJSON * localMapObject = pcc_rules_local_map ;
if ( cJSON_IsObject ( localMapObject ) ) {
localMapKeyPair = OpenAPI_map_create (
ogs_strdup ( localMapObject - > string ) , OpenAPI_pcc_rule_parseFromJSON ( localMapObject ) ) ;
} else if ( cJSON_IsNull ( localMapObject ) ) {
localMapKeyPair = OpenAPI_map_create ( ogs_strdup ( localMapObject - > string ) , NULL ) ;
} else {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [inner] " ) ;
goto end ;
}
OpenAPI_list_add ( pcc_rulesList , localMapKeyPair ) ;
}
}
2021-07-08 06:00:59 +00:00
}
2023-10-05 11:39:14 +00:00
}
2020-12-11 19:03:20 +00:00
2023-03-01 08:50:25 +00:00
pcscf_rest_indication = cJSON_GetObjectItemCaseSensitive ( sm_policy_decisionJSON , " pcscfRestIndication " ) ;
2021-07-16 08:02:33 +00:00
if ( pcscf_rest_indication ) {
2021-07-07 08:32:55 +00:00
if ( ! cJSON_IsBool ( pcscf_rest_indication ) ) {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [pcscf_rest_indication] " ) ;
goto end ;
2020-12-11 19:03:20 +00:00
}
2021-07-08 06:00:59 +00:00
}
2020-12-11 19:03:20 +00:00
2023-03-01 08:50:25 +00:00
qos_decs = cJSON_GetObjectItemCaseSensitive ( sm_policy_decisionJSON , " qosDecs " ) ;
2021-07-16 08:02:33 +00:00
if ( qos_decs ) {
2023-03-01 08:50:25 +00:00
cJSON * qos_decs_local_map = NULL ;
if ( ! cJSON_IsObject ( qos_decs ) & & ! cJSON_IsNull ( qos_decs ) ) {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [qos_decs] " ) ;
2020-12-11 19:03:20 +00:00
goto end ;
}
2023-03-01 08:50:25 +00:00
if ( cJSON_IsObject ( qos_decs ) ) {
qos_decsList = OpenAPI_list_create ( ) ;
OpenAPI_map_t * localMapKeyPair = NULL ;
cJSON_ArrayForEach ( qos_decs_local_map , qos_decs ) {
cJSON * localMapObject = qos_decs_local_map ;
if ( cJSON_IsObject ( localMapObject ) ) {
localMapKeyPair = OpenAPI_map_create (
ogs_strdup ( localMapObject - > string ) , OpenAPI_qos_data_parseFromJSON ( localMapObject ) ) ;
} else if ( cJSON_IsNull ( localMapObject ) ) {
localMapKeyPair = OpenAPI_map_create ( ogs_strdup ( localMapObject - > string ) , NULL ) ;
} else {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [inner] " ) ;
goto end ;
}
OpenAPI_list_add ( qos_decsList , localMapKeyPair ) ;
}
}
2021-07-08 06:00:59 +00:00
}
2020-12-11 19:03:20 +00:00
2023-03-01 08:50:25 +00:00
chg_decs = cJSON_GetObjectItemCaseSensitive ( sm_policy_decisionJSON , " chgDecs " ) ;
2021-07-16 08:02:33 +00:00
if ( chg_decs ) {
2023-10-05 11:39:14 +00:00
if ( ! cJSON_IsNull ( chg_decs ) ) {
2023-03-01 08:50:25 +00:00
cJSON * chg_decs_local_map = NULL ;
if ( ! cJSON_IsObject ( chg_decs ) & & ! cJSON_IsNull ( chg_decs ) ) {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [chg_decs] " ) ;
2020-12-11 19:03:20 +00:00
goto end ;
}
2023-03-01 08:50:25 +00:00
if ( cJSON_IsObject ( chg_decs ) ) {
chg_decsList = OpenAPI_list_create ( ) ;
OpenAPI_map_t * localMapKeyPair = NULL ;
cJSON_ArrayForEach ( chg_decs_local_map , chg_decs ) {
cJSON * localMapObject = chg_decs_local_map ;
if ( cJSON_IsObject ( localMapObject ) ) {
localMapKeyPair = OpenAPI_map_create (
ogs_strdup ( localMapObject - > string ) , OpenAPI_charging_data_parseFromJSON ( localMapObject ) ) ;
} else if ( cJSON_IsNull ( localMapObject ) ) {
localMapKeyPair = OpenAPI_map_create ( ogs_strdup ( localMapObject - > string ) , NULL ) ;
} else {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [inner] " ) ;
goto end ;
}
OpenAPI_list_add ( chg_decsList , localMapKeyPair ) ;
}
}
2021-07-08 06:00:59 +00:00
}
2023-10-05 11:39:14 +00:00
}
2020-12-11 19:03:20 +00:00
2023-03-01 08:50:25 +00:00
charging_info = cJSON_GetObjectItemCaseSensitive ( sm_policy_decisionJSON , " chargingInfo " ) ;
2021-07-16 08:02:33 +00:00
if ( charging_info ) {
2021-07-07 08:32:55 +00:00
charging_info_local_nonprim = OpenAPI_charging_information_parseFromJSON ( charging_info ) ;
2023-03-15 11:40:07 +00:00
if ( ! charging_info_local_nonprim ) {
ogs_error ( " OpenAPI_charging_information_parseFromJSON failed [charging_info] " ) ;
goto end ;
}
2021-07-08 06:00:59 +00:00
}
2020-12-11 19:03:20 +00:00
2023-03-01 08:50:25 +00:00
traff_cont_decs = cJSON_GetObjectItemCaseSensitive ( sm_policy_decisionJSON , " traffContDecs " ) ;
2021-07-16 08:02:33 +00:00
if ( traff_cont_decs ) {
2023-03-01 08:50:25 +00:00
cJSON * traff_cont_decs_local_map = NULL ;
if ( ! cJSON_IsObject ( traff_cont_decs ) & & ! cJSON_IsNull ( traff_cont_decs ) ) {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [traff_cont_decs] " ) ;
2020-12-11 19:03:20 +00:00
goto end ;
}
2023-03-01 08:50:25 +00:00
if ( cJSON_IsObject ( traff_cont_decs ) ) {
traff_cont_decsList = OpenAPI_list_create ( ) ;
OpenAPI_map_t * localMapKeyPair = NULL ;
cJSON_ArrayForEach ( traff_cont_decs_local_map , traff_cont_decs ) {
cJSON * localMapObject = traff_cont_decs_local_map ;
if ( cJSON_IsObject ( localMapObject ) ) {
localMapKeyPair = OpenAPI_map_create (
ogs_strdup ( localMapObject - > string ) , OpenAPI_traffic_control_data_parseFromJSON ( localMapObject ) ) ;
} else if ( cJSON_IsNull ( localMapObject ) ) {
localMapKeyPair = OpenAPI_map_create ( ogs_strdup ( localMapObject - > string ) , NULL ) ;
} else {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [inner] " ) ;
goto end ;
}
OpenAPI_list_add ( traff_cont_decsList , localMapKeyPair ) ;
}
}
2021-07-08 06:00:59 +00:00
}
2020-12-11 19:03:20 +00:00
2023-03-01 08:50:25 +00:00
um_decs = cJSON_GetObjectItemCaseSensitive ( sm_policy_decisionJSON , " umDecs " ) ;
2021-07-16 08:02:33 +00:00
if ( um_decs ) {
2023-10-05 11:39:14 +00:00
if ( ! cJSON_IsNull ( um_decs ) ) {
2023-03-01 08:50:25 +00:00
cJSON * um_decs_local_map = NULL ;
if ( ! cJSON_IsObject ( um_decs ) & & ! cJSON_IsNull ( um_decs ) ) {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [um_decs] " ) ;
2020-12-11 19:03:20 +00:00
goto end ;
}
2023-03-01 08:50:25 +00:00
if ( cJSON_IsObject ( um_decs ) ) {
um_decsList = OpenAPI_list_create ( ) ;
OpenAPI_map_t * localMapKeyPair = NULL ;
cJSON_ArrayForEach ( um_decs_local_map , um_decs ) {
cJSON * localMapObject = um_decs_local_map ;
if ( cJSON_IsObject ( localMapObject ) ) {
localMapKeyPair = OpenAPI_map_create (
ogs_strdup ( localMapObject - > string ) , OpenAPI_usage_monitoring_data_parseFromJSON ( localMapObject ) ) ;
} else if ( cJSON_IsNull ( localMapObject ) ) {
localMapKeyPair = OpenAPI_map_create ( ogs_strdup ( localMapObject - > string ) , NULL ) ;
} else {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [inner] " ) ;
goto end ;
}
OpenAPI_list_add ( um_decsList , localMapKeyPair ) ;
}
}
2021-07-08 06:00:59 +00:00
}
2023-10-05 11:39:14 +00:00
}
2020-12-11 19:03:20 +00:00
2023-03-01 08:50:25 +00:00
qos_chars = cJSON_GetObjectItemCaseSensitive ( sm_policy_decisionJSON , " qosChars " ) ;
2021-07-16 08:02:33 +00:00
if ( qos_chars ) {
2023-03-01 08:50:25 +00:00
cJSON * qos_chars_local_map = NULL ;
if ( ! cJSON_IsObject ( qos_chars ) & & ! cJSON_IsNull ( qos_chars ) ) {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [qos_chars] " ) ;
2020-12-11 19:03:20 +00:00
goto end ;
}
2023-03-01 08:50:25 +00:00
if ( cJSON_IsObject ( qos_chars ) ) {
qos_charsList = OpenAPI_list_create ( ) ;
OpenAPI_map_t * localMapKeyPair = NULL ;
cJSON_ArrayForEach ( qos_chars_local_map , qos_chars ) {
cJSON * localMapObject = qos_chars_local_map ;
if ( cJSON_IsObject ( localMapObject ) ) {
localMapKeyPair = OpenAPI_map_create (
ogs_strdup ( localMapObject - > string ) , OpenAPI_qos_characteristics_parseFromJSON ( localMapObject ) ) ;
} else if ( cJSON_IsNull ( localMapObject ) ) {
localMapKeyPair = OpenAPI_map_create ( ogs_strdup ( localMapObject - > string ) , NULL ) ;
} else {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [inner] " ) ;
goto end ;
}
OpenAPI_list_add ( qos_charsList , localMapKeyPair ) ;
}
}
2021-07-08 06:00:59 +00:00
}
2020-12-11 19:03:20 +00:00
2023-03-01 08:50:25 +00:00
qos_mon_decs = cJSON_GetObjectItemCaseSensitive ( sm_policy_decisionJSON , " qosMonDecs " ) ;
2021-07-16 08:02:33 +00:00
if ( qos_mon_decs ) {
2023-10-05 11:39:14 +00:00
if ( ! cJSON_IsNull ( qos_mon_decs ) ) {
2023-03-01 08:50:25 +00:00
cJSON * qos_mon_decs_local_map = NULL ;
if ( ! cJSON_IsObject ( qos_mon_decs ) & & ! cJSON_IsNull ( qos_mon_decs ) ) {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [qos_mon_decs] " ) ;
2020-12-11 19:03:20 +00:00
goto end ;
}
2023-03-01 08:50:25 +00:00
if ( cJSON_IsObject ( qos_mon_decs ) ) {
qos_mon_decsList = OpenAPI_list_create ( ) ;
OpenAPI_map_t * localMapKeyPair = NULL ;
cJSON_ArrayForEach ( qos_mon_decs_local_map , qos_mon_decs ) {
cJSON * localMapObject = qos_mon_decs_local_map ;
if ( cJSON_IsObject ( localMapObject ) ) {
localMapKeyPair = OpenAPI_map_create (
ogs_strdup ( localMapObject - > string ) , OpenAPI_qos_monitoring_data_parseFromJSON ( localMapObject ) ) ;
} else if ( cJSON_IsNull ( localMapObject ) ) {
localMapKeyPair = OpenAPI_map_create ( ogs_strdup ( localMapObject - > string ) , NULL ) ;
} else {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [inner] " ) ;
goto end ;
}
OpenAPI_list_add ( qos_mon_decsList , localMapKeyPair ) ;
}
}
2021-07-08 06:00:59 +00:00
}
2023-10-05 11:39:14 +00:00
}
2020-12-11 19:03:20 +00:00
2023-03-01 08:50:25 +00:00
reflective_qo_s_timer = cJSON_GetObjectItemCaseSensitive ( sm_policy_decisionJSON , " reflectiveQoSTimer " ) ;
2021-07-16 08:02:33 +00:00
if ( reflective_qo_s_timer ) {
2021-07-07 08:32:55 +00:00
if ( ! cJSON_IsNumber ( reflective_qo_s_timer ) ) {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [reflective_qo_s_timer] " ) ;
goto end ;
2020-12-11 19:03:20 +00:00
}
2021-07-08 06:00:59 +00:00
}
2020-12-11 19:03:20 +00:00
2023-03-01 08:50:25 +00:00
conds = cJSON_GetObjectItemCaseSensitive ( sm_policy_decisionJSON , " conds " ) ;
2021-07-16 08:02:33 +00:00
if ( conds ) {
2023-10-05 11:39:14 +00:00
if ( ! cJSON_IsNull ( conds ) ) {
2023-03-01 08:50:25 +00:00
cJSON * conds_local_map = NULL ;
if ( ! cJSON_IsObject ( conds ) & & ! cJSON_IsNull ( conds ) ) {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [conds] " ) ;
2020-12-11 19:03:20 +00:00
goto end ;
}
2023-03-01 08:50:25 +00:00
if ( cJSON_IsObject ( conds ) ) {
condsList = OpenAPI_list_create ( ) ;
OpenAPI_map_t * localMapKeyPair = NULL ;
cJSON_ArrayForEach ( conds_local_map , conds ) {
cJSON * localMapObject = conds_local_map ;
if ( cJSON_IsObject ( localMapObject ) ) {
localMapKeyPair = OpenAPI_map_create (
ogs_strdup ( localMapObject - > string ) , OpenAPI_condition_data_parseFromJSON ( localMapObject ) ) ;
} else if ( cJSON_IsNull ( localMapObject ) ) {
localMapKeyPair = OpenAPI_map_create ( ogs_strdup ( localMapObject - > string ) , NULL ) ;
} else {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [inner] " ) ;
goto end ;
}
OpenAPI_list_add ( condsList , localMapKeyPair ) ;
}
}
2021-07-08 06:00:59 +00:00
}
2023-10-05 11:39:14 +00:00
}
2020-12-11 19:03:20 +00:00
2023-03-01 08:50:25 +00:00
revalidation_time = cJSON_GetObjectItemCaseSensitive ( sm_policy_decisionJSON , " revalidationTime " ) ;
2021-07-16 08:02:33 +00:00
if ( revalidation_time ) {
2023-03-01 08:50:25 +00:00
if ( ! cJSON_IsString ( revalidation_time ) & & ! cJSON_IsNull ( revalidation_time ) ) {
2021-07-07 08:32:55 +00:00
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [revalidation_time] " ) ;
goto end ;
2020-12-11 19:03:20 +00:00
}
2021-07-08 06:00:59 +00:00
}
2020-12-11 19:03:20 +00:00
2023-03-01 08:50:25 +00:00
offline = cJSON_GetObjectItemCaseSensitive ( sm_policy_decisionJSON , " offline " ) ;
2021-07-16 08:02:33 +00:00
if ( offline ) {
2021-07-07 08:32:55 +00:00
if ( ! cJSON_IsBool ( offline ) ) {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [offline] " ) ;
goto end ;
2020-12-11 19:03:20 +00:00
}
2021-07-08 06:00:59 +00:00
}
2020-12-11 19:03:20 +00:00
2023-03-01 08:50:25 +00:00
online = cJSON_GetObjectItemCaseSensitive ( sm_policy_decisionJSON , " online " ) ;
2021-07-16 08:02:33 +00:00
if ( online ) {
2021-07-07 08:32:55 +00:00
if ( ! cJSON_IsBool ( online ) ) {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [online] " ) ;
goto end ;
2020-12-11 19:03:20 +00:00
}
2021-07-08 06:00:59 +00:00
}
2020-12-11 19:03:20 +00:00
2023-03-01 10:56:49 +00:00
offline_ch_only = cJSON_GetObjectItemCaseSensitive ( sm_policy_decisionJSON , " offlineChOnly " ) ;
if ( offline_ch_only ) {
if ( ! cJSON_IsBool ( offline_ch_only ) ) {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [offline_ch_only] " ) ;
goto end ;
}
}
2023-03-01 08:50:25 +00:00
policy_ctrl_req_triggers = cJSON_GetObjectItemCaseSensitive ( sm_policy_decisionJSON , " policyCtrlReqTriggers " ) ;
2021-07-16 08:02:33 +00:00
if ( policy_ctrl_req_triggers ) {
2023-10-05 11:39:14 +00:00
if ( ! cJSON_IsNull ( policy_ctrl_req_triggers ) ) {
2023-03-01 08:50:25 +00:00
cJSON * policy_ctrl_req_triggers_local = NULL ;
if ( ! cJSON_IsArray ( policy_ctrl_req_triggers ) ) {
2020-12-11 19:03:20 +00:00
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [policy_ctrl_req_triggers] " ) ;
goto end ;
}
2023-03-01 08:50:25 +00:00
policy_ctrl_req_triggersList = OpenAPI_list_create ( ) ;
2020-12-11 19:03:20 +00:00
2023-03-01 08:50:25 +00:00
cJSON_ArrayForEach ( policy_ctrl_req_triggers_local , policy_ctrl_req_triggers ) {
2023-09-24 00:54:53 +00:00
OpenAPI_policy_control_request_trigger_e localEnum = OpenAPI_policy_control_request_trigger_NULL ;
2023-03-01 08:50:25 +00:00
if ( ! cJSON_IsString ( policy_ctrl_req_triggers_local ) ) {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [policy_ctrl_req_triggers] " ) ;
goto end ;
}
2023-09-24 00:54:53 +00:00
localEnum = OpenAPI_policy_control_request_trigger_FromString ( policy_ctrl_req_triggers_local - > valuestring ) ;
if ( ! localEnum ) {
2023-10-26 13:44:51 +00:00
ogs_info ( " Enum value \" %s \" for field \" policy_ctrl_req_triggers \" is not supported. Ignoring it ... " ,
policy_ctrl_req_triggers_local - > valuestring ) ;
} else {
OpenAPI_list_add ( policy_ctrl_req_triggersList , ( void * ) localEnum ) ;
2023-09-24 00:54:53 +00:00
}
2023-10-26 13:44:51 +00:00
}
if ( policy_ctrl_req_triggersList - > count = = 0 ) {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed: Expected policy_ctrl_req_triggersList to not be empty (after ignoring unsupported enum values). " ) ;
goto end ;
2023-03-01 08:50:25 +00:00
}
2021-07-07 08:32:55 +00:00
}
2023-10-05 11:39:14 +00:00
}
2021-07-07 08:32:55 +00:00
2023-03-01 08:50:25 +00:00
last_req_rule_data = cJSON_GetObjectItemCaseSensitive ( sm_policy_decisionJSON , " lastReqRuleData " ) ;
if ( last_req_rule_data ) {
cJSON * last_req_rule_data_local = NULL ;
if ( ! cJSON_IsArray ( last_req_rule_data ) ) {
2020-12-11 19:03:20 +00:00
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [last_req_rule_data] " ) ;
goto end ;
}
2023-03-01 08:50:25 +00:00
last_req_rule_dataList = OpenAPI_list_create ( ) ;
2022-02-05 11:20:45 +00:00
2023-03-01 08:50:25 +00:00
cJSON_ArrayForEach ( last_req_rule_data_local , last_req_rule_data ) {
if ( ! cJSON_IsObject ( last_req_rule_data_local ) ) {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [last_req_rule_data] " ) ;
goto end ;
}
OpenAPI_requested_rule_data_t * last_req_rule_dataItem = OpenAPI_requested_rule_data_parseFromJSON ( last_req_rule_data_local ) ;
if ( ! last_req_rule_dataItem ) {
ogs_error ( " No last_req_rule_dataItem " ) ;
goto end ;
}
OpenAPI_list_add ( last_req_rule_dataList , last_req_rule_dataItem ) ;
}
2021-07-08 06:00:59 +00:00
}
2020-12-11 19:03:20 +00:00
2023-03-01 08:50:25 +00:00
last_req_usage_data = cJSON_GetObjectItemCaseSensitive ( sm_policy_decisionJSON , " lastReqUsageData " ) ;
2021-07-16 08:02:33 +00:00
if ( last_req_usage_data ) {
2021-07-07 08:32:55 +00:00
last_req_usage_data_local_nonprim = OpenAPI_requested_usage_data_parseFromJSON ( last_req_usage_data ) ;
2023-03-15 11:40:07 +00:00
if ( ! last_req_usage_data_local_nonprim ) {
ogs_error ( " OpenAPI_requested_usage_data_parseFromJSON failed [last_req_usage_data] " ) ;
goto end ;
}
2021-07-08 06:00:59 +00:00
}
2020-12-11 19:03:20 +00:00
2023-03-01 08:50:25 +00:00
pra_infos = cJSON_GetObjectItemCaseSensitive ( sm_policy_decisionJSON , " praInfos " ) ;
2021-07-16 08:02:33 +00:00
if ( pra_infos ) {
2023-10-05 11:39:14 +00:00
if ( ! cJSON_IsNull ( pra_infos ) ) {
2023-03-01 08:50:25 +00:00
cJSON * pra_infos_local_map = NULL ;
if ( ! cJSON_IsObject ( pra_infos ) & & ! cJSON_IsNull ( pra_infos ) ) {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [pra_infos] " ) ;
2020-12-11 19:03:20 +00:00
goto end ;
}
2023-03-01 08:50:25 +00:00
if ( cJSON_IsObject ( pra_infos ) ) {
pra_infosList = OpenAPI_list_create ( ) ;
OpenAPI_map_t * localMapKeyPair = NULL ;
cJSON_ArrayForEach ( pra_infos_local_map , pra_infos ) {
cJSON * localMapObject = pra_infos_local_map ;
if ( cJSON_IsObject ( localMapObject ) ) {
localMapKeyPair = OpenAPI_map_create (
ogs_strdup ( localMapObject - > string ) , OpenAPI_presence_info_rm_parseFromJSON ( localMapObject ) ) ;
} else if ( cJSON_IsNull ( localMapObject ) ) {
localMapKeyPair = OpenAPI_map_create ( ogs_strdup ( localMapObject - > string ) , NULL ) ;
} else {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [inner] " ) ;
goto end ;
}
OpenAPI_list_add ( pra_infosList , localMapKeyPair ) ;
}
}
2021-07-08 06:00:59 +00:00
}
2023-10-05 11:39:14 +00:00
}
2020-12-11 19:03:20 +00:00
2023-03-01 08:50:25 +00:00
ipv4_index = cJSON_GetObjectItemCaseSensitive ( sm_policy_decisionJSON , " ipv4Index " ) ;
2021-07-16 08:02:33 +00:00
if ( ipv4_index ) {
2021-07-07 08:32:55 +00:00
if ( ! cJSON_IsNumber ( ipv4_index ) ) {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [ipv4_index] " ) ;
goto end ;
2020-12-11 19:03:20 +00:00
}
2021-07-08 06:00:59 +00:00
}
2020-12-11 19:03:20 +00:00
2023-03-01 08:50:25 +00:00
ipv6_index = cJSON_GetObjectItemCaseSensitive ( sm_policy_decisionJSON , " ipv6Index " ) ;
2021-07-16 08:02:33 +00:00
if ( ipv6_index ) {
2021-07-07 08:32:55 +00:00
if ( ! cJSON_IsNumber ( ipv6_index ) ) {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [ipv6_index] " ) ;
goto end ;
2020-12-11 19:03:20 +00:00
}
2021-07-08 06:00:59 +00:00
}
2020-12-11 19:03:20 +00:00
2023-03-01 08:50:25 +00:00
qos_flow_usage = cJSON_GetObjectItemCaseSensitive ( sm_policy_decisionJSON , " qosFlowUsage " ) ;
2021-07-16 08:02:33 +00:00
if ( qos_flow_usage ) {
2021-07-07 08:32:55 +00:00
if ( ! cJSON_IsString ( qos_flow_usage ) ) {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [qos_flow_usage] " ) ;
goto end ;
2020-12-11 19:03:20 +00:00
}
2021-07-07 08:32:55 +00:00
qos_flow_usageVariable = OpenAPI_qos_flow_usage_FromString ( qos_flow_usage - > valuestring ) ;
2021-07-08 06:00:59 +00:00
}
2020-12-11 19:03:20 +00:00
2023-03-01 08:50:25 +00:00
rel_cause = cJSON_GetObjectItemCaseSensitive ( sm_policy_decisionJSON , " relCause " ) ;
2021-07-16 08:02:33 +00:00
if ( rel_cause ) {
2021-07-07 08:32:55 +00:00
if ( ! cJSON_IsString ( rel_cause ) ) {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [rel_cause] " ) ;
goto end ;
2020-12-11 19:03:20 +00:00
}
2021-07-07 08:32:55 +00:00
rel_causeVariable = OpenAPI_sm_policy_association_release_cause_FromString ( rel_cause - > valuestring ) ;
2021-07-08 06:00:59 +00:00
}
2020-12-11 19:03:20 +00:00
2023-03-01 08:50:25 +00:00
supp_feat = cJSON_GetObjectItemCaseSensitive ( sm_policy_decisionJSON , " suppFeat " ) ;
2021-07-16 08:02:33 +00:00
if ( supp_feat ) {
2023-03-01 08:50:25 +00:00
if ( ! cJSON_IsString ( supp_feat ) & & ! cJSON_IsNull ( supp_feat ) ) {
2021-07-07 08:32:55 +00:00
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [supp_feat] " ) ;
goto end ;
2020-12-11 19:03:20 +00:00
}
2021-07-08 06:00:59 +00:00
}
2021-07-07 08:32:55 +00:00
2023-03-01 08:50:25 +00:00
tsn_bridge_man_cont = cJSON_GetObjectItemCaseSensitive ( sm_policy_decisionJSON , " tsnBridgeManCont " ) ;
2021-07-16 08:02:33 +00:00
if ( tsn_bridge_man_cont ) {
2021-07-07 08:32:55 +00:00
tsn_bridge_man_cont_local_nonprim = OpenAPI_bridge_management_container_parseFromJSON ( tsn_bridge_man_cont ) ;
2023-03-15 11:40:07 +00:00
if ( ! tsn_bridge_man_cont_local_nonprim ) {
ogs_error ( " OpenAPI_bridge_management_container_parseFromJSON failed [tsn_bridge_man_cont] " ) ;
goto end ;
}
2021-07-08 06:00:59 +00:00
}
2020-12-11 19:03:20 +00:00
2023-03-01 08:50:25 +00:00
tsn_port_man_cont_dstt = cJSON_GetObjectItemCaseSensitive ( sm_policy_decisionJSON , " tsnPortManContDstt " ) ;
2021-07-16 08:02:33 +00:00
if ( tsn_port_man_cont_dstt ) {
2021-07-07 08:32:55 +00:00
tsn_port_man_cont_dstt_local_nonprim = OpenAPI_port_management_container_parseFromJSON ( tsn_port_man_cont_dstt ) ;
2023-03-15 11:40:07 +00:00
if ( ! tsn_port_man_cont_dstt_local_nonprim ) {
ogs_error ( " OpenAPI_port_management_container_parseFromJSON failed [tsn_port_man_cont_dstt] " ) ;
goto end ;
}
2021-07-08 06:00:59 +00:00
}
2020-12-11 19:03:20 +00:00
2023-03-01 08:50:25 +00:00
tsn_port_man_cont_nwtts = cJSON_GetObjectItemCaseSensitive ( sm_policy_decisionJSON , " tsnPortManContNwtts " ) ;
2021-07-16 08:02:33 +00:00
if ( tsn_port_man_cont_nwtts ) {
2023-03-01 08:50:25 +00:00
cJSON * tsn_port_man_cont_nwtts_local = NULL ;
if ( ! cJSON_IsArray ( tsn_port_man_cont_nwtts ) ) {
2020-12-11 19:03:20 +00:00
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [tsn_port_man_cont_nwtts] " ) ;
goto end ;
}
2023-03-01 08:50:25 +00:00
tsn_port_man_cont_nwttsList = OpenAPI_list_create ( ) ;
2022-02-05 11:20:45 +00:00
2023-03-01 08:50:25 +00:00
cJSON_ArrayForEach ( tsn_port_man_cont_nwtts_local , tsn_port_man_cont_nwtts ) {
if ( ! cJSON_IsObject ( tsn_port_man_cont_nwtts_local ) ) {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [tsn_port_man_cont_nwtts] " ) ;
goto end ;
}
OpenAPI_port_management_container_t * tsn_port_man_cont_nwttsItem = OpenAPI_port_management_container_parseFromJSON ( tsn_port_man_cont_nwtts_local ) ;
if ( ! tsn_port_man_cont_nwttsItem ) {
ogs_error ( " No tsn_port_man_cont_nwttsItem " ) ;
goto end ;
}
OpenAPI_list_add ( tsn_port_man_cont_nwttsList , tsn_port_man_cont_nwttsItem ) ;
}
2021-07-08 06:00:59 +00:00
}
2020-12-11 19:03:20 +00:00
2023-03-01 08:50:25 +00:00
red_sess_indication = cJSON_GetObjectItemCaseSensitive ( sm_policy_decisionJSON , " redSessIndication " ) ;
2021-07-16 08:02:33 +00:00
if ( red_sess_indication ) {
2021-07-07 08:32:55 +00:00
if ( ! cJSON_IsBool ( red_sess_indication ) ) {
ogs_error ( " OpenAPI_sm_policy_decision_parseFromJSON() failed [red_sess_indication] " ) ;
goto end ;
2020-12-11 19:03:20 +00:00
}
2021-07-08 06:00:59 +00:00
}
2020-12-11 19:03:20 +00:00
sm_policy_decision_local_var = OpenAPI_sm_policy_decision_create (
sess_rules ? sess_rulesList : NULL ,
2023-10-05 11:39:14 +00:00
pcc_rules & & cJSON_IsNull ( pcc_rules ) ? true : false ,
2020-12-11 19:03:20 +00:00
pcc_rules ? pcc_rulesList : NULL ,
2021-07-16 08:02:33 +00:00
pcscf_rest_indication ? true : false ,
2020-12-11 19:03:20 +00:00
pcscf_rest_indication ? pcscf_rest_indication - > valueint : 0 ,
qos_decs ? qos_decsList : NULL ,
2023-10-05 11:39:14 +00:00
chg_decs & & cJSON_IsNull ( chg_decs ) ? true : false ,
2020-12-11 19:03:20 +00:00
chg_decs ? chg_decsList : NULL ,
charging_info ? charging_info_local_nonprim : NULL ,
traff_cont_decs ? traff_cont_decsList : NULL ,
2023-10-05 11:39:14 +00:00
um_decs & & cJSON_IsNull ( um_decs ) ? true : false ,
2020-12-11 19:03:20 +00:00
um_decs ? um_decsList : NULL ,
qos_chars ? qos_charsList : NULL ,
2023-10-05 11:39:14 +00:00
qos_mon_decs & & cJSON_IsNull ( qos_mon_decs ) ? true : false ,
2020-12-11 19:03:20 +00:00
qos_mon_decs ? qos_mon_decsList : NULL ,
2021-07-16 08:02:33 +00:00
reflective_qo_s_timer ? true : false ,
2020-12-11 19:03:20 +00:00
reflective_qo_s_timer ? reflective_qo_s_timer - > valuedouble : 0 ,
2023-10-05 11:39:14 +00:00
conds & & cJSON_IsNull ( conds ) ? true : false ,
2020-12-11 19:03:20 +00:00
conds ? condsList : NULL ,
2023-03-01 08:50:25 +00:00
revalidation_time & & ! cJSON_IsNull ( revalidation_time ) ? ogs_strdup ( revalidation_time - > valuestring ) : NULL ,
2021-07-16 08:02:33 +00:00
offline ? true : false ,
2020-12-11 19:03:20 +00:00
offline ? offline - > valueint : 0 ,
2021-07-16 08:02:33 +00:00
online ? true : false ,
2020-12-11 19:03:20 +00:00
online ? online - > valueint : 0 ,
2023-03-01 10:56:49 +00:00
offline_ch_only ? true : false ,
offline_ch_only ? offline_ch_only - > valueint : 0 ,
2023-10-05 11:39:14 +00:00
policy_ctrl_req_triggers & & cJSON_IsNull ( policy_ctrl_req_triggers ) ? true : false ,
2020-12-11 19:03:20 +00:00
policy_ctrl_req_triggers ? policy_ctrl_req_triggersList : NULL ,
last_req_rule_data ? last_req_rule_dataList : NULL ,
last_req_usage_data ? last_req_usage_data_local_nonprim : NULL ,
2023-10-05 11:39:14 +00:00
pra_infos & & cJSON_IsNull ( pra_infos ) ? true : false ,
2020-12-11 19:03:20 +00:00
pra_infos ? pra_infosList : NULL ,
2021-07-16 08:02:33 +00:00
ipv4_index ? true : false ,
2020-12-11 19:03:20 +00:00
ipv4_index ? ipv4_index - > valuedouble : 0 ,
2021-07-16 08:02:33 +00:00
ipv6_index ? true : false ,
2020-12-11 19:03:20 +00:00
ipv6_index ? ipv6_index - > valuedouble : 0 ,
2021-01-01 02:07:08 +00:00
qos_flow_usage ? qos_flow_usageVariable : 0 ,
rel_cause ? rel_causeVariable : 0 ,
2023-03-01 08:50:25 +00:00
supp_feat & & ! cJSON_IsNull ( supp_feat ) ? ogs_strdup ( supp_feat - > valuestring ) : NULL ,
2021-07-07 08:32:55 +00:00
tsn_bridge_man_cont ? tsn_bridge_man_cont_local_nonprim : NULL ,
2020-12-11 19:03:20 +00:00
tsn_port_man_cont_dstt ? tsn_port_man_cont_dstt_local_nonprim : NULL ,
2021-07-07 08:32:55 +00:00
tsn_port_man_cont_nwtts ? tsn_port_man_cont_nwttsList : NULL ,
2021-07-16 08:02:33 +00:00
red_sess_indication ? true : false ,
2021-07-07 08:32:55 +00:00
red_sess_indication ? red_sess_indication - > valueint : 0
) ;
2020-12-11 19:03:20 +00:00
return sm_policy_decision_local_var ;
end :
2023-03-01 08:50:25 +00:00
if ( sess_rulesList ) {
OpenAPI_list_for_each ( sess_rulesList , node ) {
OpenAPI_map_t * localKeyValue = ( OpenAPI_map_t * ) node - > data ;
ogs_free ( localKeyValue - > key ) ;
OpenAPI_session_rule_free ( localKeyValue - > value ) ;
OpenAPI_map_free ( localKeyValue ) ;
}
OpenAPI_list_free ( sess_rulesList ) ;
sess_rulesList = NULL ;
}
if ( pcc_rulesList ) {
OpenAPI_list_for_each ( pcc_rulesList , node ) {
OpenAPI_map_t * localKeyValue = ( OpenAPI_map_t * ) node - > data ;
ogs_free ( localKeyValue - > key ) ;
OpenAPI_pcc_rule_free ( localKeyValue - > value ) ;
OpenAPI_map_free ( localKeyValue ) ;
}
OpenAPI_list_free ( pcc_rulesList ) ;
pcc_rulesList = NULL ;
}
if ( qos_decsList ) {
OpenAPI_list_for_each ( qos_decsList , node ) {
OpenAPI_map_t * localKeyValue = ( OpenAPI_map_t * ) node - > data ;
ogs_free ( localKeyValue - > key ) ;
OpenAPI_qos_data_free ( localKeyValue - > value ) ;
OpenAPI_map_free ( localKeyValue ) ;
}
OpenAPI_list_free ( qos_decsList ) ;
qos_decsList = NULL ;
}
if ( chg_decsList ) {
OpenAPI_list_for_each ( chg_decsList , node ) {
OpenAPI_map_t * localKeyValue = ( OpenAPI_map_t * ) node - > data ;
ogs_free ( localKeyValue - > key ) ;
OpenAPI_charging_data_free ( localKeyValue - > value ) ;
OpenAPI_map_free ( localKeyValue ) ;
}
OpenAPI_list_free ( chg_decsList ) ;
chg_decsList = NULL ;
}
if ( charging_info_local_nonprim ) {
OpenAPI_charging_information_free ( charging_info_local_nonprim ) ;
charging_info_local_nonprim = NULL ;
}
if ( traff_cont_decsList ) {
OpenAPI_list_for_each ( traff_cont_decsList , node ) {
OpenAPI_map_t * localKeyValue = ( OpenAPI_map_t * ) node - > data ;
ogs_free ( localKeyValue - > key ) ;
OpenAPI_traffic_control_data_free ( localKeyValue - > value ) ;
OpenAPI_map_free ( localKeyValue ) ;
}
OpenAPI_list_free ( traff_cont_decsList ) ;
traff_cont_decsList = NULL ;
}
if ( um_decsList ) {
OpenAPI_list_for_each ( um_decsList , node ) {
OpenAPI_map_t * localKeyValue = ( OpenAPI_map_t * ) node - > data ;
ogs_free ( localKeyValue - > key ) ;
OpenAPI_usage_monitoring_data_free ( localKeyValue - > value ) ;
OpenAPI_map_free ( localKeyValue ) ;
}
OpenAPI_list_free ( um_decsList ) ;
um_decsList = NULL ;
}
if ( qos_charsList ) {
OpenAPI_list_for_each ( qos_charsList , node ) {
OpenAPI_map_t * localKeyValue = ( OpenAPI_map_t * ) node - > data ;
ogs_free ( localKeyValue - > key ) ;
OpenAPI_qos_characteristics_free ( localKeyValue - > value ) ;
OpenAPI_map_free ( localKeyValue ) ;
}
OpenAPI_list_free ( qos_charsList ) ;
qos_charsList = NULL ;
}
if ( qos_mon_decsList ) {
OpenAPI_list_for_each ( qos_mon_decsList , node ) {
OpenAPI_map_t * localKeyValue = ( OpenAPI_map_t * ) node - > data ;
ogs_free ( localKeyValue - > key ) ;
OpenAPI_qos_monitoring_data_free ( localKeyValue - > value ) ;
OpenAPI_map_free ( localKeyValue ) ;
}
OpenAPI_list_free ( qos_mon_decsList ) ;
qos_mon_decsList = NULL ;
}
if ( condsList ) {
OpenAPI_list_for_each ( condsList , node ) {
OpenAPI_map_t * localKeyValue = ( OpenAPI_map_t * ) node - > data ;
ogs_free ( localKeyValue - > key ) ;
OpenAPI_condition_data_free ( localKeyValue - > value ) ;
OpenAPI_map_free ( localKeyValue ) ;
}
OpenAPI_list_free ( condsList ) ;
condsList = NULL ;
}
if ( policy_ctrl_req_triggersList ) {
OpenAPI_list_free ( policy_ctrl_req_triggersList ) ;
policy_ctrl_req_triggersList = NULL ;
}
if ( last_req_rule_dataList ) {
OpenAPI_list_for_each ( last_req_rule_dataList , node ) {
OpenAPI_requested_rule_data_free ( node - > data ) ;
}
OpenAPI_list_free ( last_req_rule_dataList ) ;
last_req_rule_dataList = NULL ;
}
if ( last_req_usage_data_local_nonprim ) {
OpenAPI_requested_usage_data_free ( last_req_usage_data_local_nonprim ) ;
last_req_usage_data_local_nonprim = NULL ;
}
if ( pra_infosList ) {
OpenAPI_list_for_each ( pra_infosList , node ) {
OpenAPI_map_t * localKeyValue = ( OpenAPI_map_t * ) node - > data ;
ogs_free ( localKeyValue - > key ) ;
OpenAPI_presence_info_rm_free ( localKeyValue - > value ) ;
OpenAPI_map_free ( localKeyValue ) ;
}
OpenAPI_list_free ( pra_infosList ) ;
pra_infosList = NULL ;
}
if ( tsn_bridge_man_cont_local_nonprim ) {
OpenAPI_bridge_management_container_free ( tsn_bridge_man_cont_local_nonprim ) ;
tsn_bridge_man_cont_local_nonprim = NULL ;
}
if ( tsn_port_man_cont_dstt_local_nonprim ) {
OpenAPI_port_management_container_free ( tsn_port_man_cont_dstt_local_nonprim ) ;
tsn_port_man_cont_dstt_local_nonprim = NULL ;
}
if ( tsn_port_man_cont_nwttsList ) {
OpenAPI_list_for_each ( tsn_port_man_cont_nwttsList , node ) {
OpenAPI_port_management_container_free ( node - > data ) ;
}
OpenAPI_list_free ( tsn_port_man_cont_nwttsList ) ;
tsn_port_man_cont_nwttsList = NULL ;
}
2020-12-11 19:03:20 +00:00
return NULL ;
}
OpenAPI_sm_policy_decision_t * OpenAPI_sm_policy_decision_copy ( OpenAPI_sm_policy_decision_t * dst , OpenAPI_sm_policy_decision_t * src )
{
cJSON * item = NULL ;
char * content = NULL ;
ogs_assert ( src ) ;
item = OpenAPI_sm_policy_decision_convertToJSON ( src ) ;
if ( ! item ) {
ogs_error ( " OpenAPI_sm_policy_decision_convertToJSON() failed " ) ;
return NULL ;
}
content = cJSON_Print ( item ) ;
cJSON_Delete ( item ) ;
if ( ! content ) {
ogs_error ( " cJSON_Print() failed " ) ;
return NULL ;
}
item = cJSON_Parse ( content ) ;
ogs_free ( content ) ;
if ( ! item ) {
ogs_error ( " cJSON_Parse() failed " ) ;
return NULL ;
}
OpenAPI_sm_policy_decision_free ( dst ) ;
dst = OpenAPI_sm_policy_decision_parseFromJSON ( item ) ;
cJSON_Delete ( item ) ;
return dst ;
}